How to get current selected data in datalist from gridview inside it?
-
i have a datalist and inside it there is many rows and in one of these rows i have a gridview,. i can say that it's like the following <DataList> <tr> <td> [textbox1 control] </td> </tr> <tr> <td> [textbox2 control] </td> </tr> <tr> <td> <gridview/> </td> </tr> </DataList> my problem is when i'm in gridview RowCommand handler i want to get the data that exist in [textbox1 control] and [textbox1 control] i do the following DataListItem dataListItem = (DataListItem)((GridView)sender).Parent.Parent.Parent.Parent; string txt = ((TextBox)dataListItem.FindControl([textbox1 control])).Text.Trim(); but is this the only way to ?
-
Answer:
Would something like this work? string txt = ((TextBox)DataList.Items[0].FindControl([textbox1 control])).Text.Trim();
Amr Badawy at Stack Overflow Visit the source
Related Q & A:
- How To Get Current Rosters In Madden 12?Best solution by Yahoo! Answers
- How To Get Current Madden 12 Rosters?Best solution by operationsports.com
- How To Get Current Rosters On Madden 12?Best solution by Yahoo! Answers
- How to Get Current Browser URL in Code Behind?Best solution by stackoverflow.com
- How to get current month and year in jquery?Best solution by stackoverflow.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.