Click here to Skip to main content
15,891,777 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi Friends,
can anybody tell me how get multiple textboxes from any div in server side code.
thanx in advance
Posted
Updated 21-Dec-17 22:52pm
Comments
[no name] 31-Jan-13 7:39am    
elaborate your question..
Wasim1989 31-Jan-13 7:50am    
i have a user control MobileNo with one "textbox" inside "div (runat='server'). user can add multiple MobileNo control by clicking add button. when he submit(or save form data) the page i want to retrieve all MobileNo controls value (textboxes value) which user add.
so is there any way to get mobileNo control values
ZurdoDev 31-Jan-13 7:52am    
Depends on how you wrote the code.
[no name] 31-Jan-13 7:56am    
You can try getting textbox using this code

TextBox tb = (TextBox)div1.FindControl("TextBox ID");

You can try getting textbox using this code

TextBox tb = (TextBox)div1.FindControl("TextBox ID");
 
Share this answer
 
Comments
Wasim1989 31-Jan-13 8:28am    
thanx
var a = 0;
foreach (Control x in this.Controls)
{
  if (x is TextBox)
  {
         var variable = ((TextBox)x).Text;

          a = a+ variable  //add the results here
  }
}



Probably this will help you . Just find all the textboxes inside your div and then get the value and sum up the result.
 
Share this answer
 
Comments
Richard Deeming 22-Dec-17 12:35pm    
Asked, answered, and solved nearly FIVE YEARS AGO.

Stick to answering recent or unanswered questions.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900