the select control
-
hi all, I am designing a website and I'm using the select control. I have two question: firs:how can I undrestand that user selected one options,I think that I should "onchanged" but it doesn't work! (onchange="salam" and it doesnt call the "salam" function) second: the number of options depends on the person Id, so it's not constant!How can I control the number of options dynamtically? as show below I have used this solution but it dosen't work. this is the piece of my code!
reader = objcommand1.ExecuteReader();
inti=reader.FieldCount;
while (reader.Read())
{
if (i == 3)
{
</Script>
<option value=""></option>
<option id="post11" value="">0001</option>
<option id="post21" value="">0002</option>
<option id="post31" value="">0003</option><script runat="server">
break;
}
if( i == 2)
{</Script> <option value=""></option> <option id="post12" value="">0001</option>
////and this is my another question that how to put the text of option dynamatically
<option id="post22" value=""><script ">reader.GetValue(1)</script></option> <script runat="server"> }
-
hi all, I am designing a website and I'm using the select control. I have two question: firs:how can I undrestand that user selected one options,I think that I should "onchanged" but it doesn't work! (onchange="salam" and it doesnt call the "salam" function) second: the number of options depends on the person Id, so it's not constant!How can I control the number of options dynamtically? as show below I have used this solution but it dosen't work. this is the piece of my code!
reader = objcommand1.ExecuteReader();
inti=reader.FieldCount;
while (reader.Read())
{
if (i == 3)
{
</Script>
<option value=""></option>
<option id="post11" value="">0001</option>
<option id="post21" value="">0002</option>
<option id="post31" value="">0003</option><script runat="server">
break;
}
if( i == 2)
{</Script> <option value=""></option> <option id="post12" value="">0001</option>
////and this is my another question that how to put the text of option dynamatically
<option id="post22" value=""><script ">reader.GetValue(1)</script></option> <script runat="server"> }
For your first question, you can use the onselectedindexchanged event. For your second question, if you are storing the option values in a database, you can pull the results based on the person Id and databind it to the drop down list.
-
For your first question, you can use the onselectedindexchanged event. For your second question, if you are storing the option values in a database, you can pull the results based on the person Id and databind it to the drop down list.