Click here to Skip to main content
15,906,645 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: How to insert data into database from data set or datatable Pin
leckey18-Aug-06 6:19
leckey18-Aug-06 6:19 
AnswerRe: How to insert data into database from data set or datatable Pin
Not Active18-Aug-06 7:44
mentorNot Active18-Aug-06 7:44 
QuestionIs it possible to "Enable = false" on all a pages ASP.NET controls with a single command or loop? Pin
Red_Wizard_Shot_The_Food18-Aug-06 5:37
Red_Wizard_Shot_The_Food18-Aug-06 5:37 
AnswerRe: Is it possible to "Enable = false" on all a pages ASP.NET controls with a single command or loop? Pin
Colin Angus Mackay18-Aug-06 5:50
Colin Angus Mackay18-Aug-06 5:50 
AnswerRe: Is it possible to "Enable = false" on all a pages ASP.NET controls with a single command or loop? Pin
Mike Ellison18-Aug-06 7:19
Mike Ellison18-Aug-06 7:19 
QuestionGridView visibility issue Pin
Vipul Mehta18-Aug-06 5:11
Vipul Mehta18-Aug-06 5:11 
AnswerRe: GridView visibility issue Pin
Not Active18-Aug-06 5:49
mentorNot Active18-Aug-06 5:49 
QuestionGridView event fired twice Pin
Talal Sultan18-Aug-06 4:42
Talal Sultan18-Aug-06 4:42 
Hi,

I'm having a rather curious problem. I have a GridView (ASP.NET 2.0) that has 3 image fields (commands.) One of those fields deletes the row.

First, the command name was "delete" and so I used the GridView1_RowDeleting event method. I put the code to delete the row from the database there. Then, I changed the command name to "del" and used the GridView1_RowCommand method to catch the command and perform the deletion.

Now, after deleting the row, I would like to reload the updated table from the database and bind it again with the gridview. So I use this:

<br />
GridView1.DataSource = sessionParams.SiteDS.Tables["Users"];<br />
GridView1.DataBind();<br />


sessionParams is a class holding all the Session variables amd SiteDS is the dataset holding the tables of the website.

Now the problem: whenever I click to delete, the row after it also gets deleted, and if it's the last row I get an exception that the index is not valid. That's because the delete command is fired twice, the first time the correct row gets deleted and then for some weird reason, the event is fired again and the row after it gets deleted (since it has the same index now.)

What I noticed afterwards was that this only happens when I use the code that i mentioned above. That is, if I don't do the databind thing, only one row is deleted. However, in this case, the gridview is not updated D'Oh! | :doh:

So, what is the problem here? Why is the event fired twice?

Thanks.
Talal




"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook

AnswerRe: GridView event fired twice Pin
minhpc_bk19-Aug-06 4:02
minhpc_bk19-Aug-06 4:02 
GeneralRe: GridView event fired twice Pin
Talal Sultan20-Aug-06 20:15
Talal Sultan20-Aug-06 20:15 
GeneralRe: GridView event fired twice Pin
Talal Sultan20-Aug-06 20:59
Talal Sultan20-Aug-06 20:59 
QuestionProblem using PreviousPage Property Pin
Jay_se18-Aug-06 3:43
Jay_se18-Aug-06 3:43 
AnswerRe: Problem using PreviousPage Property Pin
minhpc_bk18-Aug-06 12:27
minhpc_bk18-Aug-06 12:27 
GeneralRe: Problem using PreviousPage Property [modified] Pin
Jay_se18-Aug-06 18:05
Jay_se18-Aug-06 18:05 
Questiondatagrid binding with database table rows as columns Pin
gbabu1718-Aug-06 3:05
gbabu1718-Aug-06 3:05 
AnswerRe: datagrid binding with database table rows as columns Pin
minhpc_bk18-Aug-06 12:28
minhpc_bk18-Aug-06 12:28 
Questiondropdownlist value from dataset is displayed incorrectly Pin
digsy_18-Aug-06 2:59
digsy_18-Aug-06 2:59 
AnswerRe: dropdownlist value from dataset is displayed incorrectly Pin
Naveed Kamboh18-Aug-06 3:07
Naveed Kamboh18-Aug-06 3:07 
GeneralRe: dropdownlist value from dataset is displayed incorrectly Pin
digsy_18-Aug-06 5:25
digsy_18-Aug-06 5:25 
AnswerRe: dropdownlist value from dataset is displayed incorrectly Pin
postmaster@programmingknowledge.com18-Aug-06 3:18
postmaster@programmingknowledge.com18-Aug-06 3:18 
QuestionAsp.net + Hiding Tree View nodes ? Pin
Naveed Kamboh18-Aug-06 2:58
Naveed Kamboh18-Aug-06 2:58 
AnswerRe: Asp.net + Hiding Tree View nodes ? Pin
Ryomin18-Aug-06 7:30
professionalRyomin18-Aug-06 7:30 
GeneralRe: Asp.net + Hiding Tree View nodes ? Pin
Naveed Kamboh22-Aug-06 23:42
Naveed Kamboh22-Aug-06 23:42 
Questionpopup menu on right click on datagrid Pin
248912818-Aug-06 2:55
248912818-Aug-06 2:55 
AnswerRe: popup menu on right click on datagrid Pin
RaghuSanta21-Aug-06 21:11
RaghuSanta21-Aug-06 21:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.