|
I want to click Mon to dynamically add 4 controls. I originally wrote it in .cs and found that it will disappear after postback, so I put it in html. Now I want to get the value of text0, text1, text3 after clicking button2, but once str + = "<input id = id" + inputNum + "type = text name = text" + inputNum + ">"; becomes str + = " <input id = id "+ inputNum +" type = text runat = server name = text "+ inputNum +"> "; Can I get text0.value in .cs without runat = server?
<script>
var inputNum = 0;
function create ()
{
var str = "";
str + = "<input id = id" + inputNum + "type = text name = text" + inputNum + ">";
inputNum ++;
str + = "<input type = text name = text" + inputNum + ">";
inputNum ++;
str + = "<input type = radio name = text" + inputNum + ">";
inputNum ++;
str + = "<input type = text name = text" + inputNum + "> <br>";
ice.innerHTML = ice.innerHTML + str;
}
</ script>
....
<tr>
<td>
<asp: Label id = "Label3" runat = "server" onclick = "create ()"> Label </ asp: Label>
</ td>
</ tr>
....
<asp: Button id = "Button2" runat = "server" Text = "Button"> </ asp: Button> |
|