| <telerik:RadGrid ID="rgLessonContent" runat="server" |
| GridLines="None" AllowPaging="true" OnPreRender="rgLessonContent_PreRender" |
| PageSize="9" OnNeedDataSource="rgLessonContent_NeedDataSource" |
| ShowHeader="False"> |
| <ClientSettings> |
| <Selecting AllowRowSelect="True" /> |
| <ClientEvents OnRowSelected="RowSelected" /> |
| </ClientSettings> |
| <PagerStyle Mode="NextPrevAndNumeric" /> |
| <MasterTableView TableLayout="Fixed" > |
| <ItemTemplate> |
| <%# (((GridItem)Container).ItemIndex != 0)? "</td></tr></table>" : "" %> |
| <asp:Panel ID="ItemContainer" CssClass='<%# (((GridItem)Container).ItemType == GridItemType.Item)? "item" : "alternatingItem" %>' |
| runat="server" Width="400px" Height="150px"> |
| <table width="100%" style="border-style:none"> |
| <tr> |
| <td style="width: 100px"> |
| <asp:Image runat="server" ID="imgSlide" Width="100px" Height="100px" ImageUrl='<%# Eval("LessonContentSlideImage")%>' /> |
| </td> |
| <td> |
| <table width="100%" style="border-style:none"> |
| <tr> |
| <td> |
| <asp:Label ID="Label2" runat="server" Text="Lesson Name : " CssClass="itemBlueBoldLabel" /> |
| </td> |
| <td> |
| <asp:Label ID="Label3" runat="server" Text='<%# Eval("LessonName")%>' CssClass="itemBlackLabel" /> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <asp:Label ID="Label4" runat="server" Text="Content Name : " CssClass="itemBlueBoldLabel" /> |
| </td> |
| <td> |
| <asp:Label ID="Label5" runat="server" Text='<%# Eval("Name")%>' CssClass="itemBlackLabel" /> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <asp:Label ID="Label6" runat="server" Text="Passing Score : " CssClass="itemBlueBoldLabel" /> |
| </td> |
| <td> |
| <asp:Label ID="Label7" runat="server" Text='<%# Eval("PassingScore")%>' CssClass="itemBlackLabel" /> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <asp:Label ID="Label8" runat="server" Text="Maximum Score : " CssClass="itemBlueBoldLabel" /> |
| </td> |
| <td> |
| <asp:Label ID="Label9" runat="server" Text='<%# Eval("MaxScore")%>' CssClass="itemBlackLabel" /> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <asp:Label ID="Label10" runat="server" Text="Published : " CssClass="itemBlueBoldLabel" /> |
| </td> |
| <td> |
| <asp:Label ID="Label11" runat="server" Text='<%# Eval("IsPublished")%>' CssClass="itemBlackLabel" /> |
| </td> |
| </tr> |
| </table> |
| </td> |
| </tr> |
| </table> |
| </asp:Panel> |
| </ItemTemplate> |
| </MasterTableView> |
| <GroupingSettings CaseSensitive="false" /> |
| </telerik:RadGrid> |
| <AjaxSettings> |
| <telerik:AjaxSetting AjaxControlID="radComboBoxID"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="radTextBoxHomeAC" LoadingPanelID="RadLoadingPanel1"/> |
| <telerik:AjaxUpdatedControl ControlID="radTextBoxHomePrefix" LoadingPanelID="RadLoadingPanel1"/> |
| <telerik:AjaxUpdatedControl ControlID="radTextBoxHomeNum" LoadingPanelID="RadLoadingPanel1"/> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| </AjaxSettings> |


Hi,
I don't understand if this is possible... I've search and read a lot in examples and forum but I don't found any.
My scenario is a DetailsView within some ComboBox in edit template...
...when I'm in edit mode I will be select the binded value in the Combobox
(like when appends with this code <telerik:RadComboBox ID="RadCmb1" runat="server" ... SelectedValue='<%# Bind("Value")) %>' > )
...but I my case I load the ComboBox data from a webservice, but there are not items while a text is write in combo and for this reason the binding operation throws a error.
I use webservice for performance because the items in combobox are very much...
...there is a way to select an item from value when binding DetailsView?
Thanks
New
| <telerik:RadStyleSheetManager ID="ssm" runat="server" EnableStyleSheetCombine="true"> |
| <StyleSheets> |
| <telerik:StyleSheetReference Path="~/Apps/RTO/styles/rto.css" /> |
| <telerik:StyleSheetReference Path="~/Apps/RTO/styles/popup.css" /> |
| </StyleSheets> |
| </telerik:RadStyleSheetManager> |
Folks,
Environment: RadControls for ASP.NET AJAX Q2 2009 SP1 with Visual Studio 2008 SP1. I am using Northwind Employee Table as prototype for my RadGrid and Form template with just 5 columns ([EmployeeID], [LastName], [FirstName], [City], [Country]).
Currently, if DataField ‘Country’ is Null it updates the Datafield value to “USA”. However if it is not Null, it does not update the Datafield value to “USA”; keeps the edited value.
My intention:
1) For each rows, I would like to assign automatically SqlDataSource1.UpdateParameters["Country"].DefaultValue = “USA" (i.e. GridBoundColumn ‘Country’ value be “USA”) after each RadGrid1_UpdateCommand whether it is null or has any existing values.
2) Can I change the GridBoundColumn ‘Country’ to read only so that user’s can’t make any changes to that column? But I should be to update it automatically as per #1.
Below is my codes. Thanks for any help.
GC_0620
| <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> | ||||||||||||||||||||||||||
| <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> | ||||||||||||||||||||||||||
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||||||||||||||||||||||||||
| <html xmlns="http://www.w3.org/1999/xhtml"> | ||||||||||||||||||||||||||
| <head runat="server"> | ||||||||||||||||||||||||||
| <title></title> | ||||||||||||||||||||||||||
| </head> | ||||||||||||||||||||||||||
| <body> | ||||||||||||||||||||||||||
| <form id="form1" runat="server"> | ||||||||||||||||||||||||||
| <div> | ||||||||||||||||||||||||||
| <telerik:RadScriptManager ID="RadScriptManager1" Runat="server"> | ||||||||||||||||||||||||||
| </telerik:RadScriptManager> | ||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||
| <asp:SqlDataSource ID="SqlDataSource1" runat="server" | ||||||||||||||||||||||||||
| ConnectionString="<%$ ConnectionStrings:NorthWindConnectionString %>" | ||||||||||||||||||||||||||
| DeleteCommand="DELETE FROM [Employees] WHERE [EmployeeID] = @EmployeeID" | ||||||||||||||||||||||||||
| InsertCommand="INSERT INTO [Employees] ([LastName], [FirstName], [City], [Country]) VALUES (@LastName, @FirstName, @City, @Country)" | ||||||||||||||||||||||||||
| SelectCommand="SELECT [EmployeeID], [LastName], [FirstName], [City], [Country] FROM [Employees] ORDER BY [LastName]" | ||||||||||||||||||||||||||
| UpdateCommand="UPDATE [Employees] SET [LastName] = @LastName, [FirstName] = @FirstName, [City] = @City, [Country] = @Country WHERE [EmployeeID] = @EmployeeID"> | ||||||||||||||||||||||||||
| <DeleteParameters> | ||||||||||||||||||||||||||
| <asp:Parameter Name="EmployeeID" Type="Int32" /> | ||||||||||||||||||||||||||
| </DeleteParameters> | ||||||||||||||||||||||||||
| <UpdateParameters> | ||||||||||||||||||||||||||
| <asp:Parameter Name="LastName" Type="String" /> | ||||||||||||||||||||||||||
| <asp:Parameter Name="FirstName" Type="String" /> | ||||||||||||||||||||||||||
| <asp:Parameter Name="City" Type="String" /> | ||||||||||||||||||||||||||
| <asp:Parameter Name="Country" Type="String" /> | ||||||||||||||||||||||||||
| <asp:Parameter Name="EmployeeID" Type="Int32" /> | ||||||||||||||||||||||||||
| </UpdateParameters> | ||||||||||||||||||||||||||
| <InsertParameters> | ||||||||||||||||||||||||||
| <asp:Parameter Name="LastName" Type="String" /> | ||||||||||||||||||||||||||
| <asp:Parameter Name="FirstName" Type="String" /> | ||||||||||||||||||||||||||
| <asp:Parameter Name="City" Type="String" /> | ||||||||||||||||||||||||||
| <asp:Parameter Name="Country" Type="String" /> | ||||||||||||||||||||||||||
| </InsertParameters> | ||||||||||||||||||||||||||
| </asp:SqlDataSource> | ||||||||||||||||||||||||||
| <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" | ||||||||||||||||||||||||||
| AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" | ||||||||||||||||||||||||||
| AllowAutomaticDeletes="True" AllowAutomaticInserts="True" | ||||||||||||||||||||||||||
| AllowAutomaticUpdates="True" | ||||||||||||||||||||||||||
| DataSourceID="SqlDataSource1" GridLines="None" | ||||||||||||||||||||||||||
| AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True" | ||||||||||||||||||||||||||
| onupdatecommand="RadGrid1_UpdateCommand" > | ||||||||||||||||||||||||||
| <MasterTableView datakeynames="EmployeeID" CommandItemDisplay="TopAndBottom" Name = "Master" datasourceid="SqlDataSource1"> | ||||||||||||||||||||||||||
| <RowIndicatorColumn> | ||||||||||||||||||||||||||
| <HeaderStyle Width="20px"></HeaderStyle> | ||||||||||||||||||||||||||
| </RowIndicatorColumn> | ||||||||||||||||||||||||||
| <ExpandCollapseColumn> | ||||||||||||||||||||||||||
| <HeaderStyle Width="20px"></HeaderStyle> | ||||||||||||||||||||||||||
| </ExpandCollapseColumn> | ||||||||||||||||||||||||||
| <Columns> | ||||||||||||||||||||||||||
| <telerik:GridBoundColumn DataField="EmployeeID" DataType="System.Int32" | ||||||||||||||||||||||||||
| HeaderText="EmployeeID" ReadOnly="True" SortExpression="EmployeeID" | ||||||||||||||||||||||||||
| UniqueName="EmployeeID"> | ||||||||||||||||||||||||||
| </telerik:GridBoundColumn> | ||||||||||||||||||||||||||
| <telerik:GridBoundColumn DataField="LastName" HeaderText="LastName" | ||||||||||||||||||||||||||
| SortExpression="LastName" UniqueName="LastName"> | ||||||||||||||||||||||||||
| </telerik:GridBoundColumn> | ||||||||||||||||||||||||||
| <telerik:GridBoundColumn DataField="FirstName" HeaderText="FirstName" | ||||||||||||||||||||||||||
| SortExpression="FirstName" UniqueName="FirstName"> | ||||||||||||||||||||||||||
| </telerik:GridBoundColumn> | ||||||||||||||||||||||||||
| <telerik:GridBoundColumn DataField="City" HeaderText="City" | ||||||||||||||||||||||||||
| SortExpression="City" UniqueName="City"> | ||||||||||||||||||||||||||
| </telerik:GridBoundColumn> | ||||||||||||||||||||||||||
| <telerik:GridBoundColumn DataField="Country" HeaderText="Country" | ||||||||||||||||||||||||||
| SortExpression="Country" UniqueName="Country"> | ||||||||||||||||||||||||||
| </telerik:GridBoundColumn> | ||||||||||||||||||||||||||
| </Columns> | ||||||||||||||||||||||||||
| <EditFormSettings EditFormType="Template"> | ||||||||||||||||||||||||||
| <FormTemplate> | ||||||||||||||||||||||||||
| <table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="0" rules="none" | ||||||||||||||||||||||||||
| style="border-collapse: collapse; background: white;"> | ||||||||||||||||||||||||||
| <tr> | ||||||||||||||||||||||||||
| <td> | ||||||||||||||||||||||||||
| <table id="Table4" cellspacing="1" cellpadding="1" width="250" border="0" class="module"> | ||||||||||||||||||||||||||
| <tr> | ||||||||||||||||||||||||||
| <td> | ||||||||||||||||||||||||||
| FirstName:</td> | ||||||||||||||||||||||||||
| <td> | ||||||||||||||||||||||||||
| <asp:TextBox ID="TextBox2" Text='<%# Bind( "FirstName") %>' runat="server" > | ||||||||||||||||||||||||||
| </asp:TextBox></td> | ||||||||||||||||||||||||||
| </tr> | ||||||||||||||||||||||||||
| <tr> | ||||||||||||||||||||||||||
| <td> | ||||||||||||||||||||||||||
| Last Name:</td> | ||||||||||||||||||||||||||
| <td> | ||||||||||||||||||||||||||
| <asp:TextBox ID="TextBox3" Text='<%# Bind( "LastName") %>' runat="server" > | ||||||||||||||||||||||||||
| </asp:TextBox></td> | ||||||||||||||||||||||||||
| </tr> | ||||||||||||||||||||||||||
| <tr> | ||||||||||||||||||||||||||
| <td> | ||||||||||||||||||||||||||
| City:</td> | ||||||||||||||||||||||||||
| <td> | ||||||||||||||||||||||||||
| <asp:TextBox ID="Textbox5" Text='<%# Bind( "City") %>' runat="server"> | ||||||||||||||||||||||||||
| </asp:TextBox></td> | ||||||||||||||||||||||||||
| </tr> | ||||||||||||||||||||||||||
| <tr> | ||||||||||||||||||||||||||
| <td> | ||||||||||||||||||||||||||
| Country:</td> | ||||||||||||||||||||||||||
| <td> | ||||||||||||||||||||||||||
| <asp:TextBox ID="TextBox4" Text='<%# Bind( "Country") %>' runat="server" > | ||||||||||||||||||||||||||
| </asp:TextBox></td> | ||||||||||||||||||||||||||
| </tr> | ||||||||||||||||||||||||||
| </table> | ||||||||||||||||||||||||||
| </td> | ||||||||||||||||||||||||||
| <td> | ||||||||||||||||||||||||||
| </td> | ||||||||||||||||||||||||||
| </tr> | ||||||||||||||||||||||||||
| <tr> | ||||||||||||||||||||||||||
| <td align="right" colspan="2"> | ||||||||||||||||||||||||||
| <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' | ||||||||||||||||||||||||||
| runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'> | ||||||||||||||||||||||||||
| </asp:Button> | ||||||||||||||||||||||||||
| <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" | ||||||||||||||||||||||||||
| CommandName="Cancel"></asp:Button></td> | ||||||||||||||||||||||||||
| </tr> | ||||||||||||||||||||||||||
| </table> | ||||||||||||||||||||||||||
| </FormTemplate> | ||||||||||||||||||||||||||
| </EditFormSettings> | ||||||||||||||||||||||||||
| </MasterTableView> | ||||||||||||||||||||||||||
| <ClientSettings> | ||||||||||||||||||||||||||
| <Selecting AllowRowSelect="True" /> | ||||||||||||||||||||||||||
| </ClientSettings> | ||||||||||||||||||||||||||
| </telerik:RadGrid> | ||||||||||||||||||||||||||
| </form> | ||||||||||||||||||||||||||
| </body> | ||||||||||||||||||||||||||
| </html> | ||||||||||||||||||||||||||
| .Code Behind
|

| <telerik:RadGrid ID="radGridUnits" runat="server" AllowPaging="false" Width="100%" |
| AllowSorting="false" AutoGenerateColumns="false" GridLines="Both" CssClass="selfHierarchyTable" |
| oninsertcommand="radGridUnits_InsertCommand" |
| onupdatecommand="radGridUnits_UpdateCommand" |
| ondeletecommand="radGridUnits_DeleteCommand" |
| onitemdatabound="radGridUnits_ItemDataBound" |
| onneeddatasource="radGridUnits_NeedDataSource" |
| OnItemCreated="radGridUnits_ItemCreated" |
| OnColumnCreated="radGridUnits_ColumnCreated" |
| Skin="Default" onitemcommand="radGridUnits_ItemCommand"> |
| <mastertableview commanditemdisplay="Top" datakeynames="ID, ParentID" |
| HierarchyLoadMode="ServerOnDemand" |
| editmode="EditForms" name="Master" Width="100%" |
| nomasterrecordstext="<%$ Resources:resources,Msg_NoUnits %>" |
| tablelayout="Fixed"> |
| <SelfHierarchySettings ParentKeyName="ParentID" KeyName="ID" /> |
| <commanditemsettings addnewrecordtext="<%$ Resources:resources,Grid_AddUnit %>" refreshtext="<%$ Resources:resources,Grid_Refresh %>" /> |
| <Columns> |
| <telerik:GridTemplateColumn UniqueName="Name2" HeaderText="<%$ Resources:resources,Label_Name %>"> |
| <ItemTemplate> |
| <asp:Button ID="MyExpandCollapseButton" runat="server" CommandName="ExpandCollapse" OnClick="button_Click"></asp:Button> |
| <asp:Label ID="labelName" runat="server" Text='<%# Eval("Name") %>'></asp:Label> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |