The motivation is simple. Using the same __doPostBack([tablename],
'Select$[table row index]') function generated on the 'Select' button
link from AutoGenerateSelectButton flag being set to true, I have made
it so that whenever you click on a row in the GridView, it executes as
if the select button was clicked. However, if I remove the
AutoGenerateSelectButton property, the __doPostBack function is no
longer defined. This is quite annoying because the 'Select' button is
ugly and takes away from the ease of use.
I haven't found much information on this, so any would be greatly
appreciated.
hopefully this gives you the start that you need, if you need more
help, shoot me an email.
HTH,
Darren Kopp
http://blog.secudocs.com/
Here's the progression that I imagine most people inexperienced at this
(like me) will go through.
In Page_Load:
if (!IsPostBack){
[...]
// Add __getPostBack to onclick handler for a gridview row
for (int i=0; i < myGridView.Rows.Count; i++)
{
myGridView.Rows[i].Attributes.Add("onclick",
ClientScript.GetPostBackEventReference(myGridView, "Select$"+i));
}
}
But this still doesn't work. You must add to the @Page directive
EnableEventValidation="false". This may raise some security issues to
be dealt with later.
Ok, so at this point, you can remove the AutoGenerateSelectButton
attribute from the GridView and it will work. However, once the
Postback is performed, __doPostBack is no longer registered. Simply
move the loop out of the "if(!IsPostBack)" scope and it's all set.
Thanks for the info, Darren Kopp.