We can't. At least, not unless we redo GridView as well.
What do you want to do to GridViewRow?
Superguppie.
Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
When all you've got is a Hammer, Every Problem looks like a Nail. Michael Swain.
I agree that you may want to look at RowCreated/RowDataBound handlers first. If you can do the trick with those, it will likely be easier than making custom types.
If you do need a custom type (or you are just curious on how to do it) you need to subtype GridView and override CreateRow. CreateRow can then produce an object of your GridViewRow subtype.
Superguppie.
Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
When all you've got is a Hammer, Every Problem looks like a Nail. Michael Swain.
I want to create a Function (that i want to it to reside on GridViewRow that) will Get The Object Value. By doing this, i will shorten my coding as well as for easier maintenance.
In Form View customer class example, i create a function :
public string GetTextBoxValue(string sObjectName)
{
return ((TextBox)this.FindControl(sObjectName)).Text;
}
Superguppie.
Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
When all you've got is a Hammer, Every Problem looks like a Nail. Michael Swain.
andysujoto
Member
213 Points
144 Posts
Custom Class of GridViewRow
May 15, 2012 01:25 PM|LINK
Hi,
As on subject, how do we do it?
Thanks,
Andy
superguppie
All-Star
48225 Points
8679 Posts
Re: Custom Class of GridViewRow
May 16, 2012 01:58 PM|LINK
We can't. At least, not unless we redo GridView as well.
What do you want to do to GridViewRow?
Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
When all you've got is a Hammer, Every Problem looks like a Nail. Michael Swain.
Qin Dian Tan...
All-Star
113532 Points
12480 Posts
Microsoft
Re: Custom Class of GridViewRow
May 17, 2012 08:22 AM|LINK
Hi,
Do you mean you want to bind custom class to GridView?
http://www.vinull.com/Post/2007/04/16/aspnet-gridview-and-objectdatasource-wi.aspx
http://blogs.msdn.com/b/mikechr/archive/2006/05/17/600697.aspx
Thanks,
If you have any feedback about my replies, please contactmsdnmg@microsoft.com.
Microsoft One Code Framework
andysujoto
Member
213 Points
144 Posts
Re: Custom Class of GridViewRow
May 18, 2012 05:15 AM|LINK
hi superguppie, thanks.
How to redo GridView and create custom GridViewRow ?
I just want to add some functions to GridViewRow.
andysujoto
Member
213 Points
144 Posts
Re: Custom Class of GridViewRow
May 18, 2012 05:15 AM|LINK
Hi Qin, i just want to create some functions on GridViewRow. thanks
Qin Dian Tan...
All-Star
113532 Points
12480 Posts
Microsoft
Re: Custom Class of GridViewRow
May 18, 2012 05:34 AM|LINK
Hi,
You can handle the RowDataBound event of GridView to do anything to GridViewRow (e.Row).
Thanks,
If you have any feedback about my replies, please contactmsdnmg@microsoft.com.
Microsoft One Code Framework
superguppie
All-Star
48225 Points
8679 Posts
Re: Custom Class of GridViewRow
May 21, 2012 12:26 PM|LINK
I agree that you may want to look at RowCreated/RowDataBound handlers first. If you can do the trick with those, it will likely be easier than making custom types.
If you do need a custom type (or you are just curious on how to do it) you need to subtype GridView and override CreateRow. CreateRow can then produce an object of your GridViewRow subtype.
Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
When all you've got is a Hammer, Every Problem looks like a Nail. Michael Swain.
andysujoto
Member
213 Points
144 Posts
Re: Custom Class of GridViewRow
May 28, 2012 11:35 AM|LINK
Hi Qin and Superguppie,
I want to create a Function (that i want to it to reside on GridViewRow that) will Get The Object Value. By doing this, i will shorten my coding as well as for easier maintenance.
In Form View customer class example, i create a function :
public string GetTextBoxValue(string sObjectName)
{
return ((TextBox)this.FindControl(sObjectName)).Text;
}
in my coding, i only need to issue :
FormViewCustom.GetTextBoxValue("DateTextBox");
rather than
((TextBox)FormViewCustom.FindControl("DateTextBox")).Text;
Regards,
Andy
superguppie
All-Star
48225 Points
8679 Posts
Re: Custom Class of GridViewRow
Jun 01, 2012 10:49 AM|LINK
You may want to try this with an Extension Method.
Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
When all you've got is a Hammer, Every Problem looks like a Nail. Michael Swain.