<telerik:RadGrid ID="RadGrid1" AllowFilteringByColumn="true" PageSize="20" ShowFooter="True" AllowPaging="True" AllowSorting="true" AutoGenerateColumns="false" GridLines="None" ShowStatusBar="true" runat="server" OnItemCreated="RadGrid1_ItemCreated" onneeddatasource="RadGrid1_NeedDataSource"> <GroupingSettings CaseSensitive="false" /> <MasterTableView EditMode="InPlace" AllowFilteringByColumn="True" ShowFooter="True" DataKeyNames="ArticleID" TableLayout="Fixed"> <Columns> <telerik:GridBoundColumn DataField="Title" HeaderText="Tiêu đề"> </telerik:GridBoundColumn> <telerik:GridDateTimeColumn FilterControlWidth="95px" DataField="AddedDate" HeaderText="Ngày đăng" SortExpression="AddedDate" UniqueName="AddedDate" PickerType="DatePicker" EnableRangeFiltering="true" DataFormatString="{0:dd/MM/yyyy}"> <HeaderStyle Width="160px" /> </telerik:GridDateTimeColumn> <telerik:GridTemplateColumn DataField="CateID" HeaderText="Danh mục" UniqueName="CateID" HeaderStyle-Width="200px" SortExpression="DisplayOrder"> <FilterTemplate> <telerik:RadComboBox ID="RadComboBoxCategories" runat="server"> </telerik:RadComboBox> </FilterTemplate> <ItemTemplate> <%# Eval("udv_Categories.Title") %> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView> </telerik:RadGrid>$find("<%= MainRibbonBar.ClientID %>").findButtonByValue(button).get_owner().set_text("newtext");<span class="rrbButtonMid rrbSplitButton"><span class="rrbButtonIn"><span class="rrbImagePlaceholder"><img alt="Item Image" src="/Images/Icons/Save.png" class="rrbButtonImage" style="visibility: visible;"></span><span class="rrbButtonText"><span class="rrbTextContent">newtext</span></span><span class="rrbButtonArrow"><span class="rrbIcon"></span><span class="rrbButtonText"><span class="rrbTextContent">oldtext</span></span></span></span></span>
Protected Sub RadGrid1_UpdateCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.UpdateCommand
'If e.CommandName = RadGrid.UpdateCommandName Then
If e.CommandName = "UpdateEdited" Then
If TypeOf e.Item Is GridDataItem Then
Dim editItem As GridDataItem = CType(e.Item, GridDataItem)
Dim id As String = editItem.GetDataKeyValue("FIRM_CODE").ToString()
If id IsNot Nothing Then
//I am stuck here. How do I fetch the values for COMET_DESCRIPTOR and COMET_TRANS_NOTES
Dim UpdateCommand As String = "update tablename set COMET_DESCRIPTOR = '@COMET_DESCRIPTOR', COMET_TRANS_NOTES ='@COMET_TRANS_NOTES' where FIRM_CODE = '" & id & "' and REF_YY||REF_MM ='@REF_YY'||'@REF_MM'"
End If
End If
End If
End Sub

<telerik:RadGrid ID="gridUserAssignment" runat="server" DataSourceID="llblgUserAssignmentData" AllowAutomaticUpdates="true" AutoGenerateEditColumn="true" AllowAutomaticDeletes="false" AutoGenerateDeleteColumn="false" OnNeedDataSource="gridUserAssignment_NeedDataSource" OnDeleteCommand="gridUserAssignment_DeleteCommand" OnEditCommand="gridUserAssignment_EditCommand" OnItemCommand="gridUserAssignment_ItemCommand" OnPdfExporting="gridUserAssignment_PdfExporting"> <ClientSettings> <Selecting AllowRowSelect="True" /> </ClientSettings> <MasterTableView AutoGenerateColumns="False" DataKeyNames="RoleId" DataSourceID="llblgUserAssignmentData" EditMode="InPlace" CommandItemDisplay="Top" > <CommandItemSettings ShowExportToPdfButton="true" ShowExportToCsvButton="true" ShowAddNewRecordButton="False" ShowRefreshButton="false"> </CommandItemSettings> <Columns> <telerik:GridTemplateColumn HeaderText="#" UniqueName="RowNumber" HeaderStyle-Width="3%"> <ItemTemplate> <asp:Label runat="server" ID="lblRowNumberAccessUsers" Width="50px" Text='<%# Container.DataSetIndex+1 %>'></asp:Label> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridAutocompleteColumn DataField="Adname" FilterControlAltText="Filter Adname column" HeaderText="User AD Username" SortExpression="Adname" UniqueName="Adname" DataSourceID="llblgADusers" DataValueField="SAmaccountName" DataTextField="SAmaccountName" Filter="Contains" InputType="Text" SelectionMode="Single" AllowCustomEntry="false" > <telerik:GridBoundColumn DataField="ADuserDetail.Title" ReadOnly="true" FilterControlAltText="Filter User Title column" HeaderText="User Title" SortExpression="Usertitle" UniqueName="Usertitle"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ADuserDetail.Email" ReadOnly="true" FilterControlAltText="Filter email column" HeaderText="User email" SortExpression="email" UniqueName="email"> </telerik:GridBoundColumn> </Columns> </MasterTableView> </telerik:RadGrid><llblgenpro:LLBLGenProDataSource ID="llblgUserAssignmentData" runat="server" DataContainerType="EntityCollection" EntityCollectionTypeName="UserManagement.CollectionClasses.UserRoleUserCollection, UserManagement" ></llblgenpro:LLBLGenProDataSource><llblgenpro:LLBLGenProDataSource ID="llblgADusers" runat="server" DataContainerType="EntityCollection" EntityCollectionTypeName="UserManagement.CollectionClasses.AduserDetailCollection, UserManagement" ></llblgenpro:LLBLGenProDataSource>001.<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TesterApp.Default" %>002.<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">003.</asp:Content>004.<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">005. <form id="form1" runat="server">006. <asp:Label ID="GridStatusLabel" runat="server" Text="Nothing Yet" ForeColor="#33CC33"></asp:Label>007.<br />008. <telerik:RadScriptManager ID="RadScriptManager1" runat="server"/>009. 010. <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" MinDisplayTime="1000" Skin="Silk">011. </telerik:RadAjaxLoadingPanel>012. 013. <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel">014. <AjaxSettings>015. 016. <telerik:AjaxSetting AjaxControlID="SampleGrid">017. <UpdatedControls>018. <telerik:AjaxUpdatedControl ControlID="SampleGrid" LoadingPanelID="RadAjaxLoadingPanel1" />019. <telerik:AjaxUpdatedControl ControlID="GridStatusLabel"/>020. </UpdatedControls>021. </telerik:AjaxSetting>022. 023. </AjaxSettings>024. </telerik:RadAjaxManager>025. 026. <telerik:RadGrid027. ID="SampleGrid"028. runat="server"029. AllowPaging="True"030. AllowSorting="True"031. ShowStatusBar="True"032. GroupPanelPosition="Top"033. 034. AllowAutomaticUpdates="True"035. AllowAutomaticInserts="True"036. AllowAutomaticDeletes="True"037. 038. OnNeedDataSource="SampleGrid_NeedDataSource"039. 040. OnItemCommand="SampleGrid_ItemCommand"041. OnItemDataBound="SampleGrid_ItemDataBound"042. OnBatchEditCommand="SampleGrid_BatchEditCommand"043. 044. Skin="Silk"045. Height="467px"046. >047. <MasterTableView048. DataKeyNames="PersonID"049. AutoGenerateColumns="false"050. EditMode="Batch"051. CommandItemStyle-Wrap="false" ItemStyle-Wrap="false"052. CommandItemDisplay="TopAndBottom"053. CommandItemSettings-ShowExportToExcelButton="true"054. CommandItemSettings-ShowExportToPdfButton="true"055. >056. <BatchEditingSettings057. EditType="Cell"058. OpenEditingEvent="DblClick"059. />060. <Columns>061. <telerik:GridBoundColumn062. UniqueName="rgcPersonID"063. DataField="PersonID"064. DataType="System.Int32"065. Display="False"066. >067. </telerik:GridBoundColumn>068. 069. <telerik:GridBoundColumn070. UniqueName="rgcFirst"071. DataField="First"072. HeaderText="First Name"073. >074. </telerik:GridBoundColumn>075. 076. <telerik:GridBoundColumn077. UniqueName="rgcInitial"078. DataField= "Initial"079. HeaderText="Mid Initial"080. >081. </telerik:GridBoundColumn>082. 083. <telerik:GridBoundColumn084. UniqueName="rgcLast"085. DataField= "Last"086. HeaderText="Last Name"087. >088. </telerik:GridBoundColumn>089. 090. <telerik:GridBoundColumn091. UniqueName="rgcProfession"092. DataField= "Profession"093. HeaderText="Profession"094. ItemStyle-Wrap="false"095. >096. </telerik:GridBoundColumn>097. 098. <telerik:GridTemplateColumn099. UniqueName="rgcEntree"100. HeaderText="Entree"101. HeaderToolTip="This person's favorite meal, of course!"102. DataField="EntreeID"103. AllowSorting="true"104. SortExpression="EntreeID"105. HeaderStyle-Width="90"106. ItemStyle-Width="50px"107. ItemStyle-HorizontalAlign="Center"108. HeaderStyle-HorizontalAlign="Center"109. Resizable="false"110. ItemStyle-Wrap="false"111. >112. <ItemTemplate>113. <asp:Label ID="lblEntree" runat="server" Text='<%# Eval("EntreeFaveID")%>' ></asp:Label>114. </ItemTemplate>115. <EditItemTemplate>116. <telerik:RadComboBox117. UniqueName="rcbunEntree"118. ID="rcbidEntreeID"119. DataValueField="EntreeID"120. DataTextField="Name"121. runat="server"122. OnPreRender="rcbidEntreeID_PreRender"123. >124. </telerik:RadComboBox>125. </EditItemTemplate>126. </telerik:GridTemplateColumn>127. 128. <telerik:GridTemplateColumn129. UniqueName="rgcSalad"130. HeaderText="Salad"131. HeaderToolTip="I think it's healthy."132. DataField="SaladID"133. AllowSorting="true"134. SortExpression="SaladID"135. HeaderStyle-Width="90"136. ItemStyle-Width="50px"137. ItemStyle-HorizontalAlign="Center"138. HeaderStyle-HorizontalAlign="Center"139. Resizable="false" ItemStyle-Wrap="false"140. >141. <ItemTemplate>142. <asp:Label ID="lblSalad" runat="server" Text='<%# Eval("SaladFaveID")%>' ></asp:Label>143. </ItemTemplate>144. <EditItemTemplate>145. <telerik:RadComboBox146. UniqueName="rcbunSalad"147. ID="rcbidSaladID"148. DataValueField="SaladID"149. DataTextField="Name"150. runat="server"151. OnPreRender="rcbidSaladID_PreRender"152. >153. </telerik:RadComboBox>154. </EditItemTemplate>155. </telerik:GridTemplateColumn>156. 157. <telerik:GridTemplateColumn158. UniqueName="rgcDateFaveEaten"159. AllowSorting="true"160. ItemStyle-HorizontalAlign="Center"161. HeaderStyle-HorizontalAlign="Center"162. HeaderText="Last Meal Date"163. SortExpression="rgcDateFaveEaten"164. >165. <ItemTemplate>166. <asp:Label runat="server" ID="lblDateFaveEaten" Text='<%# Eval("DateFaveEaten", "{0:MM/dd/yyyy}") %>'>167. </asp:Label>168. </ItemTemplate>169. <EditItemTemplate>170. <telerik:RadDatePicker ID="rdpDateFaveEaten" runat="server" Width="100">171. </telerik:RadDatePicker>172. </EditItemTemplate>173. </telerik:GridTemplateColumn>174. </Columns>175. </MasterTableView>176. 177. <ClientSettings178. AllowKeyboardNavigation="True"179. EnableRowHoverStyle="true"180. >181. <ClientEvents OnCellSelected=""/>182. <Selecting AllowRowSelect="True" CellSelectionMode="SingleCell" />183. <Scrolling AllowScroll="True" UseStaticHeaders="True" />184. <Resizing AllowColumnResize="True" ClipCellContentOnResize="true" ResizeGridOnColumnResize="false" />185. </ClientSettings>186. <PagerStyle Height="40px" />187. 188. <FilterMenu EnableEmbeddedSkins="True" Skin ="Silk"></FilterMenu>189. </telerik:RadGrid>190. </form>191.</asp:Content>001.using System;002.using System.Data;003.using System.Linq;004.using Telerik.Web.UI;005.using System.Web.UI.WebControls;006. 007.namespace TesterApp {008. 009. public partial class Default : System.Web.UI.Page010. {011. private DataTable Foodies = new DataTable("FoodLiker");012. private DataTable Entrees = new DataTable("Entree");013. private DataTable Salads = new DataTable("Salad");014. 015. protected void Page_Load(object sender, EventArgs e)016. {017. Entrees.Columns.Add("EntreeID", typeof(Int32));018. Entrees.Columns.Add("Name", typeof(string));019. Entrees.Columns.Add("Description", typeof(string));020. 021. Salads.Columns.Add("SaladID", typeof(Int32));022. Salads.Columns.Add("Name", typeof(string));023. Salads.Columns.Add("Description", typeof(string));024. 025. Foodies.Columns.Add("PersonID", typeof(Int32));026. Foodies.Columns.Add("First", typeof(string));027. Foodies.Columns.Add("Initial", typeof(char));028. Foodies.Columns.Add("Last", typeof(string));029. Foodies.Columns.Add("Profession", typeof(string));030. Foodies.Columns.Add("EntreeFaveID", typeof(Int32));031. Foodies.Columns.Add("SaladFaveID", typeof(Int32));032. Foodies.Columns.Add("DateFaveEaten", typeof(string));033. 034. Entrees.Rows.Add(100, "No Entree Chosen", "Choose, or Lose. It's how you play the game.");035. Entrees.Rows.Add(111, "Spicy Honey-Brushed Chicken Thighs", "Habanero Flavored Chicken Pieces Dipped in Blended Comb Scraped Off with a Denman Grooming Brush");036. Entrees.Rows.Add(222, "Easy Baked Fish Fillets", "Preschool Bag of Cod Pieces Made to Prepare with a Ten Watt Light Bulb");037. Entrees.Rows.Add(333, "Spaghetti with Sausage and Tomato Sauce", "Pasta Pushed through a Struddler with Chunks of Imitation Meat Substitute and Ketchup");038. Entrees.Rows.Add(444, "Miso-Glazed Salmon", "Salmon in a Bowl of Miso Soup");039. Entrees.Rows.Add(555, "Chicken Cordon Bleu", "Fancy Poultry Slices Eaten with Your Pinky Finger Sticking Out");040. Entrees.Rows.Add(666, "Shrimp and Broccoli Stir-Fry", "Sea Creatures Curled up with Flakey Plastic Tails with Pieces of Broccoli Mixed together with a Paddle inside a Fryolater");041. 042. Salads.Rows.Add(80, "No Salad Chosen", "Choose Your Destiny");043. Salads.Rows.Add(81, "Jello Salad", "I think this was in a Bill Cosby Commercial");044. Salads.Rows.Add(82, "Ambrosia", "A Salad if it Was Bought in a Candy Store");045. Salads.Rows.Add(83, "Celery Victor", "Named after the Guy");046. Salads.Rows.Add(84, "Coleslaw", "Mixed with Original Recipe Chicken, you Have Soggy Sweet Chicken");047. Salads.Rows.Add(85, "Crab Louie", "Under the Sea, Everything's Better, Everything's Wetter, Take it from Me");048. Salads.Rows.Add(86, "Glorified Rice", "I Thought this was Supposed to be a Salad");049. 050. Foodies.Rows.Add(10000, "Jim", "K", "TheJay", "Filmographer", 333, 82,"1/10/2015");051. Foodies.Rows.Add(20000, "Kevin", null, "Slevin", "Step Dancer", 222, 86,"1/10/2015");052. Foodies.Rows.Add(30000, "Cathleen", "M", "Fuhrsberg", "Colecovision Repair Dude", 555, 82,"1/10/2015");053. Foodies.Rows.Add(40000, "Trey", null, "Chase", "Salesman of the Year", 666, 81,"1/10/2015");054. Foodies.Rows.Add(50000, "Chevy", "B", "Taylor", "Professional Rumorist", 222, 82,"1/10/2015");055. Foodies.Rows.Add(60000, "Lance", "K", "Simmons", "The One Who's Got it All Figured Out", 111, 86,"1/10/2015");056. Foodies.Rows.Add(70000, "Sandy", null, "Seekleston", "Brainwashing Machine Repair Man", 222, 83,"1/10/2015");057. }058. 059. protected void SampleGrid_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)060. {061. SampleGrid.DataSource = Foodies;062. }063. 064. protected void SampleGrid_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)065. {066. if (e.CommandName == "DeleteRecord")067. {068. GridStatusLabel.Text = "Deleted a Record.";069. }070. }071. 072. protected void SampleGrid_BatchEditCommand(object sender, Telerik.Web.UI.GridBatchEditingEventArgs e)073. {074. foreach (GridBatchEditingCommand command in e.Commands)075. {076. switch (command.Type)077. {078. case GridBatchEditingCommandType.Update:079. GridStatusLabel.Text = "Update a Record from Batch Edit";080. break;081. case GridBatchEditingCommandType.Insert:082. GridStatusLabel.Text = "Insert a Record from Batch Edit";083. break;084. case GridBatchEditingCommandType.Delete:085. GridStatusLabel.Text = "Delete a Record from Batch Edit";086. break;087. }088. }089. }090. 091. protected void SampleGrid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)092. {093. if (e.Item is GridDataItem)094. {095. // Setup Handlers for the Grid Data096. GridDataItem dataItem = e.Item as GridDataItem;097. Label lbl;098. 099. // Populate the Entree Drop Down100. lbl = (Label)dataItem["rgcEntree"].FindControl("lblEntree");101. if (lbl != null) {102. if (lbl.Text.Length <= 0)103. lbl.Text = "100";104. 105. Entrees.PrimaryKey = new DataColumn[] { Entrees.Columns["EntreeID"] };106. DataRow currentRecordRow = Entrees.Rows.Find(Convert.ToInt32(lbl.Text));107. lbl.Text = currentRecordRow["Name"].ToString();108. }109. 110. // Populate the Salad Drop Down111. lbl = (Label)dataItem["rgcSalad"].FindControl("lblSalad");112. if (lbl != null) {113. if (lbl.Text.Length <= 0)114. lbl.Text = "100";115. 116. Salads.PrimaryKey = new DataColumn[] { Salads.Columns["SaladID"] };117. DataRow currentRecordRow = Salads.Rows.Find(Convert.ToInt32(lbl.Text));118. lbl.Text = currentRecordRow["Name"].ToString();119. }120. 121. }122. }123. 124. protected void rcbidEntreeID_PreRender(object sender, EventArgs e)125. {126. RadComboBox combo = sender as RadComboBox;127. 128. combo.DataSource = Entrees;129. combo.DataValueField = "EntreeID";130. combo.DataTextField = "Name";131. combo.ToolTip = "Description";132. combo.DataBind();133. }134. 135. protected void rcbidSaladID_PreRender(object sender, EventArgs e)136. {137. RadComboBox combo = sender as RadComboBox;138. 139. combo.DataSource = Salads;140. combo.DataValueField = "SaladID";141. combo.DataTextField = "Name";142. combo.ToolTip = "Description";143. combo.DataBind();144. }145. }146.}