Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GridView data from nonVisible cols
Message
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
ASP.NET
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01376604
Message ID:
01377026
Views:
18
>
>Because this is a grid I cannot just put the values to hidden fields on the form.

If you use a templated column you can. That's basically the point of them - it lets you embed any custom HTML markup and/or web controls into a row in a column. Then embed the value with some markup, ex:
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:HiddenField runat="server" ID="txtHidden" Value='< %# Bind("NameOfFieldOrProperty") %>' />
                    </ItemTemplate>
                </asp:TemplateField>  
The only real "trick" to getting the value is to use FindControl on the row of the grid to get a reference to the hidden control:
HiddenField hidden = gdrow.FindControl("txtHidden") as HiddenField;

if (hidden != null)
{
   // Access hidden.Text to retrieve value from control
}
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform