Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > GridView inside a FormView

Reply
Thread Tools

GridView inside a FormView

 
 
Tony WONG
Guest
Posts: n/a
 
      12-31-2009
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


 
Reply With Quote
 
 
 
 
Abdul Sami
Guest
Posts: n/a
 
      01-02-2010
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
>
>
> .
>

 
Reply With Quote
 
 
 
 
Abdul Sami
Guest
Posts: n/a
 
      01-02-2010
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
>
>
> .
>

 
Reply With Quote
 
Tony WONG
Guest
Posts: n/a
 
      01-04-2010
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" <(E-Mail Removed)> 撰寫於郵件新聞:(E-Mail Removed)...
> 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
>>
>>
>> .
>>



 
Reply With Quote
 
Tony WONG
Guest
Posts: n/a
 
      01-07-2010
thanks abdul

finally i understand what you mean.


"Tony WONG" <(E-Mail Removed)> 撰寫於郵件新聞:(E-Mail Removed) bl...
> 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" <(E-Mail Removed)> 撰寫於郵件新聞:(E-Mail Removed)...
>> 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
>>>
>>>
>>> .
>>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView inside FormView cannot get into Edit Mode Don ASP .Net 1 09-26-2008 10:56 AM
sqldatasource selectparameters hooked to a control inside a gridview or formview? jobs ASP .Net 0 09-27-2007 09:15 PM
GridView not entering Line Editing mode when inside FormView =?Utf-8?B?QWRhciBXZXNsZXk=?= ASP .Net 5 05-28-2007 01:44 AM
gridview / datasource inside a formview> Tarren ASP .Net 0 09-12-2006 08:42 PM
access controls inside formview inside loginview wikkiwikkiwaa ASP .Net 2 08-09-2006 06:27 AM



Advertisments