New Message on dotNET User Group Hyd

Interesting problem...dropdown in datagrid

Reply
  Reply to Sender   Recommend Message 2 in Discussion
From: RameshKumarCH

try this

using itemtemplate
add asp:dropdown like

<ItemTemplate>
<asp:DropDownList id="abcd" runat="server" Width="120px"
Height="18px"></asp:DropDownList>
</ItemTemplate>

In datagrid_Itemdatabound

get the data from database and bind dataset

if dataset!=null
{
abcd.DataTextField=DS.Tables[0].Columns[0].ColumnName;
abcd.DataValueField =DS.Tables[0].Columns[1].ColumnName;
}


I hope this will work out.















>From: "dotNET User Group Hyd" <[email protected]>
>Reply-To: "dotNET User Group Hyd" <[email protected]>
>To: "dotNET User Group Hyd" <[email protected]>
>Subject: Interesting problem...dropdown in datagrid
>Date: Wed, 31 Aug 2005 09:15:55 -0700
>
>
>
>
>
>
>
>
>
>
>
>
> 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.
>
>
>
>
>
>
>
>
>
>
>
>
>
>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.
>
>
>
>
>
>
>



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