tag:blogger.com,1999:blog-171924705653813582.post5551327424783109846..comments2022-04-01T18:38:53.286+03:00Comments on It Could Be Done!: GridView with Multiple Rows Selected, Controls in the Template Column and Edit ModeYuriy Solodkyyhttp://www.blogger.com/profile/04926659302956943479noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-171924705653813582.post-48416532358882919962009-02-10T14:44:00.000+02:002009-02-10T14:44:00.000+02:00Hi can you please provide source code for the samp...Hi <BR/>can you please provide source code for the sample gridview?<BR/>Thanks in advance.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-171924705653813582.post-76528592280041144722008-11-25T08:37:00.000+02:002008-11-25T08:37:00.000+02:00Hi Edward, without regard to the sampe code I beli...Hi Edward, without regard to the sampe code I believe that you shoukd never have grids with thousand rows even with paging. Have you ever tried to work with such grids? I prefer to think that there is always better way to organize UI. <BR/>The sample shows some techniques. Nothing more.Yuriy Solodkyyhttps://www.blogger.com/profile/04926659302956943479noreply@blogger.comtag:blogger.com,1999:blog-171924705653813582.post-81727825046980954222008-11-20T19:40:00.000+02:002008-11-20T19:40:00.000+02:00Hi,Thank you for typing your solution, and for sma...Hi,<BR/>Thank you for typing your solution, and for small grids, it may be an actual solution.<BR/>But try this with a few thousand rows, and you will see that the viewstate that will be generated is over 5mb.<BR/>Couple that with a postback on every click, and you get an unusable page.<BR/>I would suggest that you look at replacing the asp checkbox with a regular html checkbox, and doing all of the event handling with javascript. The preferred solution would assign the event handlers at page load, that way you only traverse the dom once.Edward M. Meshurishttps://www.blogger.com/profile/06512188173453042791noreply@blogger.comtag:blogger.com,1999:blog-171924705653813582.post-2150513646472783502008-07-23T21:48:00.000+03:002008-07-23T21:48:00.000+03:00Awesome recomendation from Paul Schroeder protecte...Awesome recomendation from Paul Schroeder <BR/><BR/>protected void gvDetail_RowDataBound(object sender, GridViewRowEventArgs e)<BR/>{<BR/>CheckBox chkRemove = FindControl("chkRemove");<BR/>long eiaid = (long)DataBinder.Eval(e.Row.DataItem, "Element_Instance_Attribute_ID");<BR/><BR/>chkRemove.Attributes.Add("xID", eiaid.ToString());<BR/>chkRemove.Checked = (DataBinder.Eval(e.Row.DataItem, "IsRemove").ToString() == "0") ? false : true;<BR/>}<BR/><BR/>very thanks from Mexico.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-171924705653813582.post-2361053563861267452008-02-28T16:26:00.000+02:002008-02-28T16:26:00.000+02:00Excactly what I needed to get going. I added an at...Excactly what I needed to get going. I added an attribute to the checkbox where I saved the database row id, used this attribute as value for ViewState and it works perfect. Combined that with a hidden checkboxlist so I could easily process the selections.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-171924705653813582.post-2509341273899770652008-02-05T14:58:00.000+02:002008-02-05T14:58:00.000+02:00I will restore this attachment today in few hours....I will restore this attachment today in few hours. Please check again several hours later.Yuriy Solodkyyhttps://www.blogger.com/profile/04926659302956943479noreply@blogger.comtag:blogger.com,1999:blog-171924705653813582.post-36162245933003821722008-02-05T14:48:00.000+02:002008-02-05T14:48:00.000+02:00how can i get source file of this programhow can i get source file of this programAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-171924705653813582.post-4841371739257229882007-08-01T01:38:00.000+03:002007-08-01T01:38:00.000+03:00Hi Paul, If you can store checked value in your da...Hi Paul,<BR/> <BR/>If you can store checked value in your data source that is the easiest solution. However, it is not always possible to update you original data source. In this case, ViewState approach can also work. UniqueID cannot be used if you apply filter, but you can retrieve row key value and use it instead of UniqueID as ViewState key. In your sample you could use Element_Instance_Attribute_ID as key for the ViewState.Yuriy Solodkyyhttps://www.blogger.com/profile/04926659302956943479noreply@blogger.comtag:blogger.com,1999:blog-171924705653813582.post-31328434002501505042007-08-01T01:21:00.000+03:002007-08-01T01:21:00.000+03:00I was unable to use this solution because of filte...I was unable to use this solution because of filtering that changes the data that goes into eack UniqueID property.<BR/><BR/>Instead, since I am using AJAX I made use of the <BR/>ScriptManager.GetCurrent(this).IsInAsyncPostBack<BR/><BR/>property inside of the CheckedChanged event. This eliminates processing during the second databinding call when we don't have the true checked state of the control. See below:<BR/><BR/>protected void chkRemove_CheckedChanged(object sender, EventArgs e)<BR/>{<BR/> if (ScriptManager.GetCurrent(this).IsInAsyncPostBack)<BR/> {<BR/> CheckBox checkbox = sender as CheckBox;<BR/> long eiaid = long.Parse(checkbox.Attributes["xID"]);<BR/><BR/> // Do Something...<BR/> }<BR/>}<BR/><BR/>protected void gvDetail_RowDataBound(object sender, GridViewRowEventArgs e)<BR/>{<BR/> CheckBox chkRemove = FindControl("chkRemove");<BR/> long eiaid = (long)DataBinder.Eval(e.Row.DataItem, "Element_Instance_Attribute_ID");<BR/><BR/> chkRemove.Attributes.Add("xID", eiaid.ToString());<BR/> chkRemove.Checked = (DataBinder.Eval(e.Row.DataItem, "IsRemove").ToString() == "0") ? false : true;<BR/>}Anonymousnoreply@blogger.com