Hi Telerik,
i saw your example of using a user control in RadGrid to mmake a custom edit mode and I have some wuestions about it:
1. in the user control, i want to have access in the code behind to the recieved data item. how can i do that?
2. The reason i ask it is because i didn't manage to perform more complicated data binding in the user control. I wanted to bind a dropdown list to one of the dataItem fields. this is the full dataItem that is returened by the datasource in the main grid:
and in my user control, i tried to Bind / Eval it in the ASCX side:
but the second Eval doesn't work.
3. To make things more neat, is it possible to user DetailsView in the edited user control and use it's events? Can you please demonstrate how to bind it to the returned data item? do you have a better recommendation for this use?
Thanks,
Hadar
i saw your example of using a user control in RadGrid to mmake a custom edit mode and I have some wuestions about it:
1. in the user control, i want to have access in the code behind to the recieved data item. how can i do that?
2. The reason i ask it is because i didn't manage to perform more complicated data binding in the user control. I wanted to bind a dropdown list to one of the dataItem fields. this is the full dataItem that is returened by the datasource in the main grid:
| public DataView Fill() |
| { |
| //DataView dv = new DataView(); |
| //dv.Table.DataSet.Tables.Add("tbl999"); |
| DataTable dt = new DataTable("tbl999"); |
| dt.Columns.Add(new DataColumn("Title")); |
| dt.Columns.Add(new DataColumn("isCombo")); |
| dt.Columns.Add(new DataColumn("options")); |
| for (int i = 0; i < 10; i++) |
| { |
| DataTable dtInner = new DataTable("dtInner "+i); |
| dtInner.Columns.Add(new DataColumn("optionValue")); |
| dtInner.Columns.Add(new DataColumn("optionTitle")); |
| for(int j=0;j<i;j++){ |
| dtInner.Rows.Add(j,"option " + j); |
| } |
| DataView dvInner = dtInner.DefaultView; |
| dt.Rows.Add("Question number " + i, Convert.ToBoolean(i % 2), dvInner); |
| } |
| DataView dv = dt.DefaultView; |
| return dv; |
| } |
| <td style="width: 50%"> |
| <asp:Label ID="lblOptionTitle" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Title") %>'></asp:Label> |
| </td> |
| <asp:DropDownList runat="server" DataSource='<%# DataBinder.Eval(Container, "DataItem.options") %>' OnDataBinding="dropdownlist2_DataBound" |
| ID="dropdownlist2" AppendDataBoundItems="true" DataTextField="optionTitle" DataValueField="optionValue" DataMember="options"> |
| </asp:DropDownList> <td style="width: 50%"> |
| </td> |
but the second Eval doesn't work.
3. To make things more neat, is it possible to user DetailsView in the edited user control and use it's events? Can you please demonstrate how to bind it to the returned data item? do you have a better recommendation for this use?
Thanks,
Hadar