New Message on dotNET User Group Hyd

Interesting problem...dropdown in datagrid

Reply
  Recommend Message 1 in Discussion
From: Rajhyd231

Hi,
 
I've a problem. I've two tables in the dataset. I use the first table(user info) to bind the datagrid. the second table(all the teams) to populate the dropdown.
 
when the page loads I want to display the team(in the dropdown) the user belongs to as selected.  How do I do that?I tried doing something like this: its not working
 
<ItemTemplate>                  <asp:DropDownList id="ddlRoles"  DataSource="<%#BindRoles()%>" DataTextField="RoleName" DataValueField="RoleID" runat="server" />                 </asp:DropDownList>                </ItemTemplate>
 
*************

protected void DefaultRole(object sender, EventArgs e)
  {
   DropDownList ddList;
   ddList=(DropDownList)sender;

   if(dsRoleConfig!=null && dsRoleConfig.Tables.Count>0)
   {
    if(dsRoleConfig.Tables[0].Rows.Count>0)
    {
     foreach(DataRow dr in dsRoleConfig.Tables[0].Rows)
     {
      //ddList.SelectedIndex=ddList.Items.IndexOf(ddList.Items.FindByValue(dr["RoleID"].ToString()));  
      ddList.SelectedIndex=ddList.Items.IndexOf(ddList.Items.FindByValue(dr["RoleID"].ToString()));  
      //ddList.Items.FindByValue(dr["RoleID"].ToString()).Selected=true;
     }
    }
   }   
  }  

 

tia,

Raj

 
 
<ITEMTEMPLATE> <asp:DropDownList id=ddlRoles runat="server" DataValueField="RoleID" DataTextField="RoleName" DataSource="<%#BindRoles()%>"></asp:DropDownList></ITEMTEMPLATE>
 
 
 

View other groups in this category.

Click Here
Also on MSN:
Start Chatting | Listen to Music | House & Home | Try Online Dating | Daily Horoscopes

To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.

Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.

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.
Remove my e-mail address from dotNET User Group Hyd.

Reply via email to