Last post Oct 22, 2015 07:01 AM by superguppie
May 15, 2012 09:25 AM|andysujoto|LINK
As on subject, how do we do it?
May 16, 2012 09:58 AM|superguppie|LINK
We can't. At least, not unless we redo GridView as well.
What do you want to do to GridViewRow?
May 17, 2012 04:22 AM|Qin Dian Tang - MSFT|LINK
Do you mean you want to bind custom class to GridView?
May 18, 2012 01:15 AM|andysujoto|LINK
hi superguppie, thanks.
How to redo GridView and create custom GridViewRow ?
I just want to add some functions to GridViewRow.
Hi Qin, i just want to create some functions on GridViewRow. thanks
May 18, 2012 01:34 AM|Qin Dian Tang - MSFT|LINK
You can handle the RowDataBound event of GridView to do anything to GridViewRow (e.Row).
May 21, 2012 08:26 AM|superguppie|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.
May 28, 2012 07:35 AM|andysujoto|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)
in my coding, i only need to issue :
Jun 01, 2012 06:49 AM|superguppie|LINK
You may want to try this with an
Jul 27, 2015 01:20 AM|andysujoto|LINK
Sorry for late reply.... can you describe more detail?
Oct 22, 2015 07:01 AM|superguppie|LINK
You are in luck that I had a question about something. I haven't been active on here much lately.
On a static class you can make a static method that has a first argument marked with this. The method will then apply to objects of the type of that first parameter.
public static class GridViewRowExtensions
public static object GetTextBoxValue(this GridViewRow row, string name)
will allow you to use GetTextBoxValue on a GridViewRow (if the namespace that GridViewRowExtensions is in has a using.)
protected void MyGridView_RowUpdating(object sender, GridViewUpdateEventargs e)
var myDate = e.Row.GetTextBoxValue("DateTextBox);