Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to bind dataset to textbox?
Message
 
 
À
21/10/2013 11:16:16
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01585915
Message ID:
01585950
Vues:
19
>>On the same page I have a GridView bound to a dataset. Below the GridView there is a textbox (or several textboxes). As user navigates through the GridView (clicking on this or that row) I want the value/text in the textbox(s) to be updated according to new row in the dataset. My understanding is I need to bind the textbox(s) to the same dataset. How do you do it? An example, of one textbox binding to the dataset would be very helpful.
>
>If you don't mind round-tripping to the server you can wire up the GridView.SelectedIndexChanged event and do something like this:
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
>        {
>            TextBox1.Text = GridView1.SelectedRow.Cells[2].Text;
>            //etc
>        }
I prefer not to make the "trip" back to the server. I am working on having a button field on the GridView and wire it to a method of the page. The only thing I don't know - yet - if the page has to be reposted on the call to this method. If so I will look for way to do it with jQuery so there is no reposting of the page and no trip back to the server.
Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform