-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: talktopavan
Message 1 in Discussion

 
Hi , 
I am unbale  to add a dropdown button dynamically in a webform it say  
" Control 'cboSystem' of type 'DropDownList' must be placed inside a form tag with 
runat=server. " 
I am calling the following code on cboProblem selected indexed changed event. 
I am sending the code along with this .. 
Regards 
Pavan 
private void cboProblem_SelectedIndexChanged(object sender, System.EventArgs e) 
{ 
strQuery="Select * From RuleDefinitions where Rule_ID IN ("; 
strQuery =strQuery + "select Rule_ID from GrammarDefinitions where Grammar_ID =( 
select Grammar_ID from Grammars where Grammar_ID = 1))"; 
strQuery =strQuery + "and Rule_ID in( select Rule_ID from RuleDefinitions Where 
Rule_id="+cboProblem.Items[cboProblem.SelectedIndex].Value +")"; 
objCom=new SqlCommand(); 
objCom.CommandText=strQuery; 
objCom.CommandType=CommandType.Text; 
objCom.Connection=objCon; 
objDr=objCom.ExecuteReader(); 
System.Web.UI.WebControls.DropDownList cboSystem =new 
System.Web.UI.WebControls.DropDownList(); 
cboSystem.ID="cboSystem"; 
 
 
cboSystem.Style.Add("Z-INDEX","102"); 
cboSystem.Style.Add("LEFT","320px"); 
cboSystem.Style.Add("POSITION","absolute"); 
cboSystem.Style.Add("TOP","64px"); 
//cboSystem.Width="152px"; 
cboSystem.AutoPostBack=true; 
 
cboSystem.Items.Add( new ListItem("Select Any System","-1")); 
while(objDr.Read()) 
{ 
cboSystem.Items.Add( new 
ListItem(objDr.GetString(objDr.GetOrdinal("Rule_value")),objDr.GetSqlValue(3).ToString()));
 
} 
Page.Controls.Add(cboSystem); 
objDr.Close(); 
}

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to