Last post Jul 20, 2008 11:29 AM by Samu Zhang - MSFT
Jul 17, 2008 12:23 PM|chinnibharath|LINK
I have a Gridview control,as per my requirements i have to handle gridview rowdatabound event in submit button click,
in button click event but it is firing that event..
Please tell me how to fire rowdatabound in button click...
please it's urgent..
Jul 17, 2008 12:49 PM|mohi88|LINK
(personal thoughts) i do not think that you can fire this event when you need, because
RowDataBound event fires directly after the datarow is created, but you can handel the event and check the datarow for value r what ever you like and change it before it goes to user interface.
you can handel it this way
void productsGridView_RowDataBound(object sender, GridViewRowEventArgs e) //c#
Sub productsGridView_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) //vb
hope this helps
Jul 17, 2008 12:53 PM|ramireddyindia|LINK
Why you wants to fire that event, its not possible to fire. but you can achieve same sort of functionality in that button click evetn also.
suppose your previous code is like this,
then convert the above code like this
private void myfunction(GridViewRow gvRow)
---------- here put your code that you previously inplemented in rowdatabound event
Now, in your button click event, write like this
foreach(gridviewrow gvrow in gridview1.rows)
Jul 17, 2008 01:05 PM|Pushkar|LINK
Do you want to create Handler..?
Or i think you want to bind the GridView on Button Click Event.
Thn jst call the GridView Bind method on Button Click event..
Jul 17, 2008 01:15 PM|chinnibharath|LINK
actually i want to group the gridview coloumns while displaying,
My gridview is having question heading as groups and
inside that i have to show quesion and radio button list(for rating).
i am using gridview helper class for grouping the grid columns,but it is firing rowdatabound event internally and adding a row at runtime..
so while in button click i am getting only 13 rows,but after grouping it should be 18 rows and the selected values are not in proper order..
Jul 20, 2008 11:29 AM|Samu Zhang - MSFT|LINK
Put the code in page load event:
protected void Page_Load(object sender, EventArgs e)
Then in button click event , call grvEvaluation.DataBind();