From: Tony WONG on
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
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
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
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
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
>>>
>>>
>>> .
>>>
>
>