1

Guys please help me with this..

  1. I am dynamically adding 3 textboxes, 2 radiobuttons and 5 multiline textbox controls in a table ON CLICK OF A BUTTON in asp.net
  2. I want to retrieve and store the values of each and every control.

I am very new to asp.net. Please help me.

4

2 回答 2

0

Dynamically adding controls to a page needs to specify an ID for each of those controls ! so when adding them you specify an ID for each of them and you can use that ID to retrieve and store data from and to those controls !

Code example on getting data from yourcontrols :

private void btnSave_Click(object sender, EventArgs e){
String name="";
String familyName="";
name=textbox1.Text.Trim();
familyName=textbox2.Text.Trim();
}
于 2012-06-11T09:02:15.043 回答
-1

您始终可以使用Request.Form[]

例如

Request.Form[Control.UniqueID]

要正确工作,您需要提供控件的“唯一名称 id”(而不是 id 名称)

在 request.form 中包含页面中的所有帖子参数:http: //msdn.microsoft.com/en-us/library/ms525985 (VS.90).aspx

于 2012-06-11T09:05:03.117 回答