From: Tony WONG on 30 Dec 2009 23:21 sorry for post too many question i have a gridview footer to sum up scores. it works fine due to the layout and space, then i have to put the GridView inside a "FormView" But the event handler fails to call the GridView (Handles Gridview1.RowDataBound) to sum up the scores. Grateful for any help. thx. ****** code **************************** Private Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles Gridview1.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then MemScore += Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "Score")) ElseIf e.Row.RowType = DataControlRowType.Footer Then e.Row.Cells(2).Text = MemScore.ToString("0") End If End Sub
From: Abdul Sami on 2 Jan 2010 08:49 Gridview rowDataBound will be called upon gridview.DataBind() command. At most you can try one more thing like calling gridview databind on formview ondatabound. -- Abdul Sami "Tony WONG" wrote: > sorry for post too many question > > i have a gridview footer to sum up scores. > it works fine > > due to the layout and space, then i have to put the GridView inside a > "FormView" > > But the event handler fails to call the GridView (Handles > Gridview1.RowDataBound) to sum up the scores. > > Grateful for any help. thx. > > > ****** code **************************** > Private Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As > System.Web.UI.WebControls.GridViewRowEventArgs) Handles > Gridview1.RowDataBound > If e.Row.RowType = DataControlRowType.DataRow Then > MemScore += Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, > "Score")) > ElseIf e.Row.RowType = DataControlRowType.Footer Then > e.Row.Cells(2).Text = MemScore.ToString("0") > End If > End Sub > > > . >
From: Abdul Sami on 2 Jan 2010 08:53 Also a control inside formview needs to be called in this way. GridView myGridview = (GridView)FormView1.FindControl("GridView1"); myGridview1.DataBind(); This will call the gridview1 rowDataBound event for sure. -- Abdul Sami "Tony WONG" wrote: > sorry for post too many question > > i have a gridview footer to sum up scores. > it works fine > > due to the layout and space, then i have to put the GridView inside a > "FormView" > > But the event handler fails to call the GridView (Handles > Gridview1.RowDataBound) to sum up the scores. > > Grateful for any help. thx. > > > ****** code **************************** > Private Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As > System.Web.UI.WebControls.GridViewRowEventArgs) Handles > Gridview1.RowDataBound > If e.Row.RowType = DataControlRowType.DataRow Then > MemScore += Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, > "Score")) > ElseIf e.Row.RowType = DataControlRowType.Footer Then > e.Row.Cells(2).Text = MemScore.ToString("0") > End If > End Sub > > > . >
From: Tony WONG on 4 Jan 2010 02:06 Thank you for your advices when the Gridview1.rowdatabound, then it sum up all the rows however, after Gridview1 put in a formview it cannot locate Gridview1 the 1st line after Handles has a shadow line under "Gridview1", like this Gridview1 ~~~~~~~ how can i write rowdatabound event happens in a Gridview inside a formview? Thanks a lot. ********* vb code ********************* Private Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound code..................... End Sub *********************** "Abdul Sami" <AbdulSami(a)discussions.microsoft.com> ���g��l��s�D:316AB7E5-A560-4957-96AB-543D9F7637CD(a)microsoft.com... > Also a control inside formview needs to be called in this way. > > GridView myGridview = (GridView)FormView1.FindControl("GridView1"); > myGridview1.DataBind(); > > This will call the gridview1 rowDataBound event for sure. > > > -- > Abdul Sami > > > "Tony WONG" wrote: > >> sorry for post too many question >> >> i have a gridview footer to sum up scores. >> it works fine >> >> due to the layout and space, then i have to put the GridView inside a >> "FormView" >> >> But the event handler fails to call the GridView (Handles >> Gridview1.RowDataBound) to sum up the scores. >> >> Grateful for any help. thx. >> >> >> ****** code **************************** >> Private Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As >> System.Web.UI.WebControls.GridViewRowEventArgs) Handles >> Gridview1.RowDataBound >> If e.Row.RowType = DataControlRowType.DataRow Then >> MemScore += Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, >> "Score")) >> ElseIf e.Row.RowType = DataControlRowType.Footer Then >> e.Row.Cells(2).Text = MemScore.ToString("0") >> End If >> End Sub >> >> >> . >>
From: Tony WONG on 7 Jan 2010 02:37 thanks abdul finally i understand what you mean. "Tony WONG" <x34(a)netvigator.com> ���g��l��s�D:uNGtByQjKHA.3792(a)TK2MSFTNGP02.phx.gbl... > Thank you for your advices > > when the Gridview1.rowdatabound, then it sum up all the rows > > however, after Gridview1 put in a formview > it cannot locate Gridview1 > > the 1st line after Handles has a shadow line under "Gridview1", like this > Gridview1 > ~~~~~~~ > > how can i write rowdatabound event happens in a Gridview inside a > formview? > > Thanks a lot. > > > ********* vb code ********************* > Private Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As > System.Web.UI.WebControls.GridViewRowEventArgs) Handles > GridView1.RowDataBound > code..................... > End Sub > *********************** > > > > > > "Abdul Sami" <AbdulSami(a)discussions.microsoft.com> ���g��l��s�D:316AB7E5-A560-4957-96AB-543D9F7637CD(a)microsoft.com... >> Also a control inside formview needs to be called in this way. >> >> GridView myGridview = (GridView)FormView1.FindControl("GridView1"); >> myGridview1.DataBind(); >> >> This will call the gridview1 rowDataBound event for sure. >> >> >> -- >> Abdul Sami >> >> >> "Tony WONG" wrote: >> >>> sorry for post too many question >>> >>> i have a gridview footer to sum up scores. >>> it works fine >>> >>> due to the layout and space, then i have to put the GridView inside a >>> "FormView" >>> >>> But the event handler fails to call the GridView (Handles >>> Gridview1.RowDataBound) to sum up the scores. >>> >>> Grateful for any help. thx. >>> >>> >>> ****** code **************************** >>> Private Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As >>> System.Web.UI.WebControls.GridViewRowEventArgs) Handles >>> Gridview1.RowDataBound >>> If e.Row.RowType = DataControlRowType.DataRow Then >>> MemScore += Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, >>> "Score")) >>> ElseIf e.Row.RowType = DataControlRowType.Footer Then >>> e.Row.Cells(2).Text = MemScore.ToString("0") >>> End If >>> End Sub >>> >>> >>> . >>> > >
|
Pages: 1 Prev: Javascript to retrieve Gridview cell text Next: Can't use forms authentication when using IIS |