4 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 17 Feb 2009, 06:19 AM
Hi Sanjeev,
I hope the link to the online demo which shows user control edit form will help you. Check-out the link below.
User control edit form
Thanks,
Shinu.
I hope the link to the online demo which shows user control edit form will help you. Check-out the link below.
User control edit form
Thanks,
Shinu.
0
Princy
Top achievements
Rank 2
answered on 17 Feb 2009, 07:43 AM
Hello Sanjeev,
You can also check out the following code to set the SelectedValue of the ListBox in the ascx:
ascx:
Thanks
Princy.
You can also check out the following code to set the SelectedValue of the ListBox in the ascx:
ascx:
<asp:ListBox ID="ListBox1" DataSourceID="SqlDataSource1" DataTextField="ProductName" SelectedValue='<%#Eval("ProductName")%>' DataValueField="ProductName" runat="server"></asp:ListBox> |
Thanks
Princy.
0
sanjeev
Top achievements
Rank 1
answered on 17 Feb 2009, 09:18 AM
i'm using custom binding in ascx.cs so selectedvalue is not tr in listbox....
0
Princy
Top achievements
Rank 2
answered on 18 Feb 2009, 05:20 AM
Hello Sanjeev,
You can set the SelectedIndex of the ListBox in the code behind of the page that contains the grid as shown below inorder to select a listbox value corresponding to the row:
aspx.cs:
Thanks
Princy.
You can set the SelectedIndex of the ListBox in the code behind of the page that contains the grid as shown below inorder to select a listbox value corresponding to the row:
aspx.cs:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
if (e.Item is GridEditableItem && e.Item.IsInEditMode) |
{ |
GridEditableItem editItem = (GridEditableItem)e.Item; |
UserControl userControl = (UserControl)editItem.FindControl(GridEditFormItem.EditFormUserControlID); |
ListBox listbx = (ListBox)userControl.FindControl("ListBox1"); |
listbx.SelectedIndex = editItem.ItemIndex; |
} |
} |
Thanks
Princy.