Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GridView data from nonVisible cols
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
ASP.NET
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01376604
Message ID:
01377026
Vues:
15
>
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform