I am trying to set the selected value for a radcombox box in the details view of a radgrid when it is in edit mode. I have been able to do this for the mastertableview by doing the following on the grid's ItemDataBound event.
Private Sub rgvIntranetObjects_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgvIntranetObjects.ItemDataBound
If TypeOf e.Item Is GridEditFormItem AndAlso e.Item.IsInEditMode Then
Dim GridItem As GridEditFormItem = DirectCast(e.Item, GridEditFormItem)
Dim ddlModule As New DropDownList
Dim ddlType As New DropDownList
Dim txtModule As New TextBox
Dim txtType As New TextBox
ddlType = DirectCast(GridItem.FindControl("ddlObjectType"), DropDownList)
ddlModule = DirectCast(GridItem.FindControl("ddlObjectModule"), DropDownList)
txtType = DirectCast(GridItem.FindControl("txtObjectType"), TextBox)
txtModule = DirectCast(GridItem.FindControl("txtObjectModule"), TextBox)
ddlModule.SelectedValue = txtModule.Text
ddlType.SelectedValue = txtType.Text
End If
End Sub
I think that I need to do the same thing for the DetailsView on the DetailTableDataBind event but I can't figure out the correct syntax for checking if the details view is in edit mode (details view uses in-place editing) or how to get the row so that I can find the controls.
Any help would be appreciated.
Tracy
3 Answers, 1 is accepted
You can try the following code snippet to access RadComboBox in DetailTable.
VB:
Protected Sub RadGrid1_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode AndAlso e.Item.OwnerTableView.Name = "DetailTable" Then Dim edititem As GridEditableItem = DirectCast(e.Item, GridEditableItem) Dim combo As RadComboBox = DirectCast(edititem.FindControl("RadComboBox1"), RadComboBox) combo.SelectedValue = "value" End IfEnd SubThanks,
Shinu.
Thank you for your response. I was able to get my combo boxes to work correctly but they seemed to have caused another problem.
In my details view I am hiding or showing specific columns when the detail view is in edit mode using the item command and this works great. The following is the code I use to show/hide the columns.
Case "EditSelectedDetail" Dim DetailView As GridTableView = DirectCast(e.Item.OwnerTableView, GridTableView) 'Change Visibility Of Columns That Should or Should Not Be Displayed When In Edit Mode For Each GColumn As GridColumn In DetailView.Columns Select Case GColumn.UniqueName Case "ObjectIdReferenced", "ObjectTypeDetail", "ObjectName" GColumn.Visible = "false" Case "gtcObjectIdReferenced", "gtcObjectType" GColumn.Visible = "true" End Select Next The problem is that when the detail view is in edit mode and I change the first combo box value it sets the datasource for another combo box in the detail view (cascading combo boxes). This of course is causing a post back and for some reason my combo box columns disappear. I am guessing the reason is because by default I have the visible property set to false because I only want them displayed when in edit mode and when the post back occurs they default back to their original setting, although the detail view is still in edit mode. How can I prevent these columns from disappearing.
Below is my code for the page.
Thank you for your assistance.
<%@ Page Title="" Language="vb" AutoEventWireup="false" CodeBehind="WBF SYS Intranet Objects.aspx.vb" Inherits="IPS_Gateway.WBF_SYS_Intranet_Objects" %> <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="act" %> <%@ Register TagPrefix="wuc" TagName="PageHeader" Src="~/User Controls/WUC Page Heading.ascx" %> <!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 id="Head1" runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <act:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"/> <telerik:RadWindowManager ID="rwmWindowManager" runat="server" Behaviors="Close, Move" Modal="true" /> <asp:SqlDataSource ID="SQLDS_IntranetObjects" runat="server" ConnectionString="<%$ ConnectionStrings:IPSDataConnectionString %>" SelectCommandType="StoredProcedure" SelectCommand="[System].[DSP_IntranetObjects-Sel-Ins-Upd-Del]" > <SelectParameters> <asp:Parameter Name="strCommandType" Type="String" DefaultValue="Select" /> </SelectParameters> </asp:SqlDataSource> <asp:SqlDataSource ID="SQLDS_References" runat="server" ConnectionString="<%$ ConnectionStrings:IPSDataConnectionString %>" SelectCommandType="StoredProcedure" SelectCommand="[System].[DSP_IntranetObjects-Sel-Ins-Upd-Del]" > <SelectParameters> <asp:Parameter Name="strCommandType" Type="String" DefaultValue="List" /> </SelectParameters> </asp:SqlDataSource> <asp:SqlDataSource ID="SQLDS_ObjectType" runat="server" ConnectionString="<%$ ConnectionStrings:IPSDataConnectionString %>" SelectCommandType="StoredProcedure" SelectCommand="[System].[DSP_SystemIdentifiers-Sel-Ins-Upd-Del]" > <SelectParameters> <asp:Parameter Name="strLevel1" Type="String" DefaultValue="Object Type" /> <asp:Parameter Name="intLevelNumber" Type="Int16" DefaultValue="2" /> </SelectParameters> </asp:SqlDataSource> <asp:SqlDataSource ID="SQLDS_Modules" runat="server" ConnectionString="<%$ ConnectionStrings:IPSDataConnectionString %>" SelectCommandType="StoredProcedure" SelectCommand="[System].[DSP_SystemIdentifiers-Sel-Ins-Upd-Del]" > <SelectParameters> <asp:Parameter Name="strLevel1" Type="String" DefaultValue="Modules" /> <asp:Parameter Name="intLevelNumber" Type="Int16" DefaultValue="2" /> </SelectParameters> </asp:SqlDataSource> <asp:SqlDataSource ID="SQLDS_ObjectsReferenced" runat="server" ConnectionString="<%$ ConnectionStrings:IPSDataConnectionString %>" SelectCommandType="StoredProcedure" SelectCommand="[System].[DSP_IntranetObjectsReferenced-Sel-Ins-Upd-Del]" > <SelectParameters> <asp:Parameter Name="strCommandType" Type="String" DefaultValue="Select" /> </SelectParameters> </asp:SqlDataSource> <asp:panel ID="pnlPage" runat="server" CssClass="css_GPC01_Panel_MainContent"> <wuc:PageHeader ID="wucPageHeader" runat="server"></wuc:PageHeader> <asp:Panel ID="pnlPageContent" runat="server" CssClass="css_GPC01_Panel_PageContent" > <asp:UpdatePanel ID="uppGrid" runat="server" ChildrenAsTriggers="true"> <ContentTemplate> <telerik:RadGrid ID="rgvIntranetObjects" runat="server" DataSourceID="SQLDS_IntranetObjects" EnableEmbeddedSkins="true" Skin="Office2010Silver" Height="560px" Width="1230px" EnableViewState="true" EnableLinqExpressions="false" AutoGenerateColumns="false" AllowAutomaticInserts="true" AllowAutomaticUpdates="true" AllowAutomaticDeletes="true" AllowMultiRowSelection="false" AllowFilteringByColumn="true" AllowSorting="true" ShowGroupPanel="True" AllowPaging="true" PageSize="150"> <AlternatingItemStyle BackColor="#DEECFB" /> <PagerStyle AlwaysVisible="true" Mode="NextPrevAndNumeric" /> <ClientSettings AllowColumnsReorder="true" AllowDragToGroup="true" AllowGroupExpandCollapse="true" ReorderColumnsOnClient="true" EnablePostBackOnRowClick="true" AllowExpandCollapse="true" > <Resizing AllowColumnResize="true" /> <Selecting AllowRowSelect="true" /> <Scrolling AllowScroll="true" UseStaticHeaders="true" /> </ClientSettings> <GroupingSettings ShowUnGroupButton="true" /> <MasterTableView Name="IntranetObjects" DataSourceID="SQLDS_IntranetObjects" DataKeyNames="ObjectId, ObjectType" GroupLoadMode="Client" EnableViewState="true" EditMode="EditForms" CommandItemDisplay="Top" > <CommandItemTemplate > <div style="padding: 5px 5px;"> <asp:LinkButton ID="lbtAdd" runat="server" CommandName="InitInsert" ToolTip="Add New Record" Visible='<%# rgvIntranetObjects.EditIndexes.Count=0 AND Not rgvIntranetObjects.MasterTableView.IsItemInserted%>'> <asp:Image ID="imgAdd" runat="server" CssClass="css_GFS01_Image_Align" ImageURL="<%$ Resources:Images,AddRecord16%>" /> Add </asp:LinkButton> <asp:LinkButton ID="lbtEdit" runat="server" CommandName="EditSelected" ToolTip="Edit Record" Visible='<%# rgvIntranetObjects.EditIndexes.Count=0 AND Not rgvIntranetObjects.MasterTableView.IsItemInserted%>'> <asp:Image ID="imgEdit" runat="server" CssClass="css_GFS01_Image_Align" ImageURL="<%$ Resources:Images,EditRecord16%>"/> Edit </asp:LinkButton> <asp:LinkButton ID="lbtCancel" runat="server" CommandName="CancelAll" ToolTip="Cancel Edit/Add" Visible='<%# rgvIntranetObjects.EditIndexes.Count > 0 Or rgvIntranetObjects.MasterTableView.IsItemInserted %>'> <asp:Image ID="imgCancel" runat="server" CssClass="css_GFS01_Image_Align" ImageURL="<%$ Resources:Images,CancelRecord16%>" /> Cancel </asp:LinkButton> <asp:LinkButton ID="lbtSaveNew" runat="server" CommandName="PerformInsert" ToolTip="Save New Record" Visible='<%# rgvIntranetObjects.MasterTableView.IsItemInserted%>'> <asp:Image ID="imgSaveNew" runat="server" CssClass="css_GFS01_Image_Align" ImageURL="<%$ Resources:Images,SaveRecord16%>" /> Save New</asp:LinkButton> <asp:LinkButton ID="lbtDelete" runat="server" CommandName="DeleteSelected" ToolTip="Delete Record" Visible='<%# rgvIntranetObjects.EditIndexes.Count=0 and Not rgvIntranetObjects.MasterTableView.IsItemInserted%>' OnClientClick="javascript:return confirm('You have selected to delete this user.\n \nThis process CANNOT BE UNDONE.\n\rDo you want to continue?')"> <asp:Image ID="imgDelete" runat="server" CssClass="css_GFS01_Image_Align" ImageURL="<%$ Resources:Images,DeleteRecord16%>" />Delete </asp:LinkButton> <asp:LinkButton ID="lbtSave" runat="server" CommandName="UpdateEdited" ToolTip="Save Changes" Visible='<%# rgvIntranetObjects.EditIndexes.Count > 0 AND Not rgvIntranetObjects.MasterTableView.IsItemInserted%>'> <asp:Image ID="imgSave" runat="server" CssClass="css_GFS01_Image_Align" ImageURL="<%$ Resources:Images,SaveRecord16%>" /> Update </asp:LinkButton> <asp:LinkButton ID="lbtParameters" runat="server" CommandName="ShowParameters" ToolTip="View Object Parameters" Visible='<%# rgvIntranetObjects.EditIndexes.Count=0 AND Not rgvIntranetObjects.MasterTableView.IsItemInserted%>'> <asp:Image ID="imgGroupSettings" runat="server" CssClass="css_GFS01_Image_Align" ImageURL="<%$ Resources:Images,GroupSecurity20%>" /> Object Parameters</asp:LinkButton> <asp:LinkButton ID="lbtAddParameters" runat="server" CommandName="AddParameters" ToolTip="Add Object Parameters" Visible='<%# rgvIntranetObjects.EditIndexes.Count=0 AND Not rgvIntranetObjects.MasterTableView.IsItemInserted%>'> <asp:Image ID="Image1" runat="server" CssClass="css_GFS01_Image_Align" ImageURL="<%$ Resources:Images,GroupSecurity20%>" /> Object Parameters</asp:LinkButton> <asp:LinkButton ID="lbtReferences" runat="server" CommandName="ShowReferences" ToolTip="Objects Referenced In" Visible='<%# rgvIntranetObjects.EditIndexes.Count=0 AND Not rgvIntranetObjects.MasterTableView.IsItemInserted%>'> <asp:Image ID="imgSettings" runat="server" CssClass="css_GFS01_Image_Align" ImageURL="<%$ Resources:Images,SecuritySettings20%>" /> Referencing Objects </asp:LinkButton> <asp:LinkButton ID="lbtFilters" runat="server" CommandName="ShowHideFilters" ToolTip="Show/Hide Filters" style="position:absolute;left:1090px;font-size:12px;"> <asp:Image ID="imgFilter" runat="server" CssClass="css_GFS01_Image_Align" ImageURL="<%$ Resources:Images,FilterRecord16%>" /> Filter</asp:LinkButton> <asp:LinkButton ID="lbtRefresh" runat="server" CommandName="RebindGrid" ToolTip="Refresh Grid" style="position:absolute;Left:1160px;" > <asp:Image id="imgRefresh" runat="server" CssClass="css_GFS01_Image_Align" ImageURL="<%$ Resources:Images, ReloadBlue16 %>" /> Refresh</asp:LinkButton> </div> </CommandItemTemplate> <Columns> <telerik:GridBoundColumn DataField="ObjectType" UniqueName="ObjectType" HeaderText="Object Type" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="100px" SortExpression="ObjectType" DefaultInsertValue="Stored Procedure" > <FilterTemplate> <telerik:RadComboBox runat="server" ID="rcbFilterObjectType" DataSourceID="SQLDS_ObjectType" DataValueField="Level2Code" DataTextField="Level2Code" AppendDataBoundItems="true" AutoPostBack="true" AllowCustomText="true" Width="90px" OnPreRender="FilterField_PreRender" OnSelectedIndexChanged="ApplyFilter_OnSelectedIndexChanged"> <Items> <telerik:RadComboBoxItem Text="All" /> </Items> </telerik:RadComboBox> </FilterTemplate> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ObjectModule" UniqueName="ObjectModule" HeaderText="Module" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="100px" SortExpression="ObjectModule"> <FilterTemplate> <telerik:RadComboBox runat="server" ID="rcbFilterObjectModule" DataSourceID="SQLDS_Modules" DataValueField="Level2Code" DataTextField="Level2Code" AppendDataBoundItems="true" AutoPostBack="true" AllowCustomText="true" Width="90px" OnPreRender="FilterField_PreRender" OnSelectedIndexChanged="ApplyFilter_OnSelectedIndexChanged"> <Items> <telerik:RadComboBoxItem Text="All" /> </Items> </telerik:RadComboBox> </FilterTemplate> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ObjectId" UniqueName="ObjectId" HeaderText="Id" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="40px" SortExpression="ObjectId" ReadOnly="true"> <FilterTemplate></FilterTemplate> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ObjectName" UniqueName="ObjectName" HeaderText="Name" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="300px" SortExpression="ObjectName" > <FilterTemplate></FilterTemplate> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ObjectPath" UniqueName="ObjectPath" HeaderText="Path" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="180px" SortExpression="ObjectPath"> <FilterTemplate></FilterTemplate> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ExportPath" UniqueName="ExportPath" HeaderText="Export Path" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="180px" SortExpression="ExportPath"> <FilterTemplate></FilterTemplate> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ObjectDescription" UniqueName="ObjectDescription" HeaderText="Description" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="200px" SortExpression="ObjectDescription"> <FilterTemplate></FilterTemplate> </telerik:GridBoundColumn> </Columns> <EditFormSettings EditFormType="Template"> <FormTemplate> <asp:Table id="tblEdit" runat="server" cellspacing="10" cellpadding="1" width="1210" style="border-collapse: collapse; background:#C3DAF6;"> <asp:TableRow Visible="false"> <asp:TableCell Width="100px"> <asp:TextBox ID="txtObjectType" runat="server" Text='<%# Bind("ObjectType") %>' /> </asp:TableCell> <asp:TableCell Width="100px"> <asp:TextBox ID="txtObjectModule" runat="server" Text='<%# Bind("ObjectModule") %>' /></asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell width="60px" CssClass="css_GFS01_TableCell_DisplayRight_SmallBlue">Object Id:</asp:TableCell> <asp:TableCell Width="100px"> <asp:TextBox ID="txtObjectId" runat="server" Text='<%# Bind("ObjectId") %>' ReadOnly='<%# rgvIntranetObjects.MasterTableView.EditMode%>' /></asp:TableCell> <asp:TableCell width="80px" CssClass="css_GFS01_TableCell_DisplayRight_SmallBlue">Object Type:</asp:TableCell> <asp:TableCell Width="150px"> <asp:dropDownList ID="ddlObjectType" runat="server" DataTextField="Level2Code" DataValueField="Level2Code" DataSourceID="SQLDS_ObjectType" AppendDataBoundItems="true" TabIndex="1" /> </asp:TableCell> <asp:TableCell width="90px" CssClass="css_GFS01_TableCell_DisplayRight_SmallBlue">Object Module:</asp:TableCell> <asp:TableCell Width="140px"> <asp:dropDownList ID="ddlObjectModule" runat="server" DataTextField="Level2Code" DataValueField="Level2Code" DataSourceID="SQLDS_Modules" AppendDataBoundItems="true" TabIndex="2" /> </asp:TableCell> <asp:TableCell width="90px" CssClass="css_GFS01_TableCell_DisplayRight_SmallBlue" >Object Name:</asp:TableCell> <asp:TableCell Width="300px" > <asp:TextBox ID="txtObjectName" runat="server" Text='<%# Bind("ObjectName") %>' Width="300px" /></asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell width="90px" CssClass="css_GFS01_TableCell_DisplayRight_SmallBlue">Object Path:</asp:TableCell> <asp:TableCell Width="800px" ColumnSpan="7" > <asp:TextBox ID="txtObjectPath" runat="server" Text='<%# Bind("ObjectPath") %>' Width="1100px" /></asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell width="90px" CssClass="css_GFS01_TableCell_DisplayRight_SmallBlue">Export Path:</asp:TableCell> <asp:TableCell Width="800px" ColumnSpan="7" > <asp:TextBox ID="txtExportPath" runat="server" Text='<%# Bind("ExportPath") %>' Width="1100px" /></asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell width="110px" CssClass="css_GFS01_TableCell_DisplayRight_SmallBlue">Object Description:</asp:TableCell> <asp:TableCell Width="800px" ColumnSpan="7"> <asp:TextBox ID="txtObjectDescription" runat="server" Text='<%# Bind("ObjectDescription") %>' Width="1100px" Wrap="true" TextMode="MultiLine" Rows="6" /></asp:TableCell> </asp:TableRow> </asp:Table> </FormTemplate> </EditFormSettings> <DetailTables> <telerik:GridTableView Name="ObjectsReferenced" DataKeyNames="ObjectId, ObjectIdReferenced, ObjectSequence" HierarchyLoadMode="ServerOnDemand" EditMode="InPlace" Caption="Objects Referenced" CommandItemDisplay="Top" AllowFilteringByColumn="false" PageSize="500" AllowPaging="false"> <AlternatingItemStyle BackColor="#E7E8F6" /> <CommandItemTemplate > <div style="padding: 5px 5px;"> <asp:LinkButton ID="lbtAddDetail" runat="server" CommandName="InitInsertDetail" ToolTip="Add New Record" Visible='<%# rgvIntranetObjects.EditIndexes.Count=0 and Not CType(Container, GridCommandItem).OwnerTableView.IsItemInserted %>'> <asp:Image ID="imgAdd" runat="server" CssClass="css_GFS01_Image_Align" ImageURL="<%$ Resources:Images,AddRecord16%>" /> Add </asp:LinkButton> <asp:LinkButton ID="lbtEditDetail" runat="server" CommandName="EditSelectedDetail" ToolTip="Edit Record" Visible='<%# rgvIntranetObjects.EditIndexes.Count=0 and Not CType(Container, GridCommandItem).OwnerTableView.IsItemInserted %>'> <asp:Image ID="imgEdit" runat="server" CssClass="css_GFS01_Image_Align" ImageURL="<%$ Resources:Images,EditRecord16%>"/> Edit </asp:LinkButton> <asp:LinkButton ID="lbtCancelDetail" runat="server" CommandName="CancelAll" ToolTip="Cancel Edit/Add" Visible='<%# rgvIntranetObjects.EditIndexes.Count > 0 Or CType(Container, GridCommandItem).OwnerTableView.IsItemInserted %>'> <asp:Image ID="imgCancel" runat="server" CssClass="css_GFS01_Image_Align" ImageURL="<%$ Resources:Images,CancelRecord16%>" /> Cancel </asp:LinkButton> <asp:LinkButton ID="lbtSaveNewDetail" runat="server" CommandName="PerformInsert" ToolTip="Save New Record" Visible='<%# CType(Container, GridCommandItem).OwnerTableView.IsItemInserted %>'> <asp:Image ID="imgSaveNew" runat="server" CssClass="css_GFS01_Image_Align" ImageURL="<%$ Resources:Images,SaveRecord16%>" /> Save New</asp:LinkButton> <asp:LinkButton ID="lbtDeleteDetail" runat="server" CommandName="DeleteSelectedDetail" ToolTip="Delete Record" Visible='<%# rgvIntranetObjects.EditIndexes.Count=0 and Not CType(Container, GridCommandItem).OwnerTableView.IsItemInserted %>' OnClientClick="javascript:return confirm('You have selected to delete this user.\nThis process CANNOT BE UNDONE.\nDo you want to continue?')"> <asp:Image ID="imgDelete" runat="server" CssClass="css_GFS01_Image_Align" ImageURL="<%$ Resources:Images,DeleteRecord16%>" />Delete </asp:LinkButton> <asp:LinkButton ID="lbtSaveDetail" runat="server" CommandName="UpdateEdited" ToolTip="Save Changes" Visible='<%# rgvIntranetObjects.EditIndexes.Count > 0 AND Not CType(Container, GridCommandItem).OwnerTableView.IsItemInserted %>'> <asp:Image ID="imgSave" runat="server" CssClass="css_GFS01_Image_Align" ImageURL="<%$ Resources:Images,SaveRecord16%>" /> Update </asp:LinkButton> <asp:LinkButton ID="lbtFiltersDetail" runat="server" CommandName="ShowHideFiltersDetail" ToolTip="Show/Hide Filter Fields" style="position:absolute;left:1050px;" > <asp:Image ID="imgFilter" runat="server" CssClass="css_GFS01_Image_Align" ImageURL="<%$ Resources:Images,FilterRecord16%>" /> Filter</asp:LinkButton> <asp:LinkButton ID="lbtRefreshDetail" runat="server" CommandName="RebindGridDetail" ToolTip="Refresh Grid" style="position:absolute;Left:1120px;" > <asp:Image id="imgRefresh" runat="server" CssClass="css_GFS01_Image_Align" ImageURL="<%$Resources:Images, ReloadBlue16 %>" /> Refresh</asp:LinkButton> </div> </CommandItemTemplate> <Columns> <telerik:GridBoundColumn UniqueName="ObjectId" DataField="Objectid" HeaderText="Object Id" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" HeaderStyle-Width="65px" ReadOnly="true" /> <telerik:GridBoundColumn DataField="ObjectType" UniqueName="ObjectTypeDetail" HeaderText="Object Type" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" HeaderStyle-Width="125px" ReadOnly="true" /> <telerik:GridBoundColumn DataField="ObjectIdReferenced" UniqueName="ObjectIdReferenced" HeaderText="Ref Id" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" HeaderStyle-Width="65px" /> <telerik:GridTemplateColumn UniqueName="gtcObjectType" HeaderText="Object Type" HeaderStyle-Width="150px" Visible="false" > <EditItemTemplate> <telerik:RadComboBox runat="server" ID="rcbObjectType" DataSourceID="SQLDS_ObjectType" DataValueField="Level2Code" DataTextField="Level2Code" AppendDataBoundItems="true" AutoPostBack="true" EnableViewState="true" Width="200px" OnSelectedIndexChanged="DetailObjectType_OnSelectedIndexChanged" /> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn UniqueName="gtcObjectIdReferenced" HeaderText="Reference Id" HeaderStyle-Width="350px" Visible="false" > <ItemTemplate> <asp:Label ID="lblObjectIdReferenced" runat="server" Text='<%# Bind("ObjectIdReferenced") %>' /> </ItemTemplate> <EditItemTemplate> <telerik:RadComboBox runat="server" ID="rcbReferencedId" DataSourceID="SQLDS_References" DataValueField="ObjectId" DataTextField="ObjectName" EnableViewState="true" Width="330px" /> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridBoundColumn DataField="ObjectSequence" UniqueName="ObjectSequence" HeaderText="Seq" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" HeaderStyle-Width="50px" ItemStyle-Width="40px" DataType="System.Int32" /> <telerik:GridBoundColumn DataField="ObjectName" UniqueName="ObjectName" HeaderText="Object Name" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" HeaderStyle-Width="300px" ReadOnly="true" /> <telerik:GridBoundColumn DataField="ReferenceDescription" UniqueName="ReferenceDescription" HeaderText="Description" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" HeaderStyle-Width="570px" ItemStyle-Width="570px" /> </Columns> </telerik:GridTableView> </DetailTables> </MasterTableView> </telerik:RadGrid> </ContentTemplate> </asp:UpdatePanel> </asp:Panel> </asp:panel> </form> </body> </html>Imports IPS_Gateway.CLS_Data_Retrieval Imports IPS_Gateway.CLS_Messages_And_Alerts Imports IPS_Gateway.CLS_Page_Display Imports IPS_Gateway.CLS_String_Functions Imports Telerik.Web.UI Imports System.Data.SqlClient Imports System.Drawing Partial Public Class WBF_SYS_Intranet_Objects Inherits System.Web.UI.Page Private MasterFlag As Boolean = False 'Variable used to hold master table record selected status Private DetailFlag As Boolean = False 'Variable used to hold detail table record selected status Protected Sub ApplyFilter_OnSelectedIndexChanged(ByVal sender As Object, ByVal e As RadComboBoxSelectedIndexChangedEventArgs) Dim strFilterValue As String = Nothing Dim rcbFilter As RadComboBox = TryCast(sender, RadComboBox) Dim strFilterName As String = rcbFilter.ID.Replace("rcbFilter", "") Dim vwsFilterName As String = strFilterName + "Filter" Dim vwsFilterExpression As String = strFilterName + "FilterExpression" Dim strFilterExpression As String = Nothing Dim aryFilterFields(3) As String Dim i As Integer If e.Value = Nothing Then strFilterValue = rcbFilter.Text Else strFilterValue = e.Value End If If strFilterValue = "All" Or strFilterValue = Nothing Then ViewState(vwsFilterName) = "All" ViewState(vwsFilterExpression) = Nothing Else strFilterExpression = UDF_GetFilterValue(strFilterValue) ViewState(vwsFilterName) = strFilterExpression ViewState(vwsFilterExpression) = "([" + strFilterName + "] " + strFilterExpression.ToString + ")" End If 'Apply The Filter To The Grid aryFilterFields(0) = "ObjectModule" aryFilterFields(1) = "ObjectType" aryFilterFields(2) = "ObjectName" strFilterExpression = Nothing vwsFilterName = Nothing vwsFilterExpression = Nothing For i = 0 To 3 vwsFilterName = aryFilterFields(i) + "Filter" vwsFilterExpression = aryFilterFields(i) + "FilterExpression" If ViewState(vwsFilterName) IsNot "All" And ViewState(vwsFilterName) IsNot Nothing Then If ViewState(vwsFilterExpression) IsNot Nothing Then If strFilterExpression IsNot Nothing Then strFilterExpression = strFilterExpression + " And " + ViewState(vwsFilterExpression) Else strFilterExpression = ViewState(vwsFilterExpression) End If End If End If Next i rgvIntranetObjects.MasterTableView.FilterExpression = strFilterExpression rgvIntranetObjects.MasterTableView.Rebind() End Sub Protected Sub FilterField_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Dim rcbFilter As RadComboBox = TryCast(sender, RadComboBox) Dim vwsFilterName As String = rcbFilter.ID.Replace("rcbFilter", "") + "Filter" If ViewState(vwsFilterName) IsNot Nothing Then rcbFilter.Text = ViewState(vwsFilterName).ToString End If End Sub Protected Sub DetailObjectType_OnSelectedIndexChanged(ByVal sender As Object, ByVal e As RadComboBoxSelectedIndexChangedEventArgs) Dim GridRow As GridEditableItem = TryCast(TryCast(sender, RadComboBox).NamingContainer, GridEditableItem) Me.SQLDS_References.SelectParameters.Clear() SQLDS_References.SelectParameters.Add("strCommandType", "Select") SQLDS_References.SelectParameters.Add("strObjectType", e.Value) SQLDS_References.DataBind() Dim rcb As RadComboBox = TryCast(GridRow("gtcObjectIdReferenced").FindControl("rcbReferencedId"), RadComboBox) rcb.DataSourceID = "SQLDS_References" rcb.DataBind() End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then Me.wucPageHeader.prpPageParameters = If(Request("PageParameters") = Nothing, "Unknown, Unknown, 0,1,1,1", Request("PageParameters")) ViewState("ExpandedRowId") = Nothing End If End Sub Private Sub rgvIntranetObjects_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles rgvIntranetObjects.DataBound 'Expand the row if any that was previously expanded when Detail Table is Rebinded If Not String.IsNullOrEmpty(ViewState("ExpandedRowId")) Then rgvIntranetObjects.Items(ViewState("ExpandedRowId")).Expanded = True End If End Sub Private Sub rgvIntranetObjects_DetailTableDataBind(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridDetailTableDataBindEventArgs) Handles rgvIntranetObjects.DetailTableDataBind Dim SelectedRow As GridDataItem = CType(e.DetailTableView.ParentItem, GridDataItem) Dim intObjectId As Int32 = SelectedRow.GetDataKeyValue("ObjectId") SQLDS_ObjectsReferenced.SelectParameters.Clear() SQLDS_ObjectsReferenced.SelectParameters.Add("strCommandType", "Select") SQLDS_ObjectsReferenced.SelectParameters.Add("intObjectId", intObjectId.ToString) e.DetailTableView.DataSource = SQLDS_ObjectsReferenced End Sub Private Sub rgvIntranetObjects_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgvIntranetObjects.ItemCommand If rgvIntranetObjects.MasterTableView.Name = "IntranetObjects" Then Select Case e.CommandName Case RadGrid.ExpandCollapseCommandName 'Save Expanded State Of MasterTableView So When DetailView Is Rebinded The MasterTableView Expanded State Can Be Set If Not e.Item.Expanded Then ViewState("ExpandedRowId") = e.Item.ItemIndexHierarchical Else ViewState("ExpandedRowId") = Nothing End If Case "ShowHideFilters" rgvIntranetObjects.MasterTableView.AllowFilteringByColumn = Not rgvIntranetObjects.MasterTableView.AllowFilteringByColumn rgvIntranetObjects.MasterTableView.Rebind() Case "EditSelected" If rgvIntranetObjects.SelectedValue Is Nothing Then ERR_SelectedRecord(Me) e.Canceled = "true" Else Dim TableView As GridTableView = DirectCast(e.Item.OwnerTableView, GridTableView) For Each GridItem As GridDataItem In TableView.Items If GridItem.Selected Then GridItem.Edit = True MasterFlag = True End If Next If MasterFlag Then TableView.Rebind() MasterFlag = False End If End If Case "DeleteSelected" If rgvIntranetObjects.SelectedValue Is Nothing Then ERR_SelectedRecord(Me) e.Canceled = "true" End If Case "RebindGrid" ViewState("ObjectTypeFilter") = "All" ViewState("ObjectTypeFilterExpression") = Nothing ViewState("ObjectModuleFilter") = "All" ViewState("ObjectModuleFilterExpression") = Nothing ViewState("ObjectNameFilter") = "All" ViewState("ObjectNameFilterExpression") = Nothing rgvIntranetObjects.MasterTableView.FilterExpression = String.Empty rgvIntranetObjects.CurrentPageIndex = 0 rgvIntranetObjects.Rebind() Case "ShowHideFiltersDetail" Dim DetailView As GridTableView = DirectCast(e.Item.OwnerTableView, GridTableView) DetailView.AllowFilteringByColumn = Not DetailView.AllowFilteringByColumn DetailView.Rebind() Case "EditSelectedDetail" Dim DetailView As GridTableView = DirectCast(e.Item.OwnerTableView, GridTableView) 'Change Visibility Of Columns That Should or Should Not Be Displayed When In Edit Mode For Each GColumn As GridColumn In DetailView.Columns Select Case GColumn.UniqueName Case "ObjectIdReferenced", "ObjectTypeDetail", "ObjectName" GColumn.Visible = "false" Case "gtcObjectIdReferenced", "gtcObjectType" GColumn.Visible = "true" End Select Next 'Loop Through Grid Items To Determine If Any Records Have Been Selected, If A Record Has Been Selected 'Put Row In Edit Mode, If No Records Have Been Selected Display Error Message For Each GridItem As GridDataItem In DetailView.Items DetailFlag = False If GridItem.Selected = True Then GridItem.Edit = GridItem.Selected DetailFlag = True Exit For End If Next If DetailFlag = False Then ERR_SelectedRecord(Me) 'If no record was selected display error message e.Canceled = "true" Else DetailView.Rebind() End If Case "InitInsertDetail" Dim DetailView As GridTableView = DirectCast(e.Item.OwnerTableView, GridTableView) DetailView.IsItemInserted = True 'Change Visibility Of Columns That Should or Should Not Be Displayed When In Insert Mode For Each GColumn As GridColumn In DetailView.Columns Select Case GColumn.UniqueName Case "ObjectIdReferenced", "ObjectTypeDetail", "ObjectName" GColumn.Visible = "false" Case "gtcObjectIdReferenced", "gtcObjectType" GColumn.Visible = "true" End Select Next DetailView.Rebind() Case "DeleteSelectedDetail" Dim DetailView As GridTableView = DirectCast(e.Item.OwnerTableView, GridTableView) For Each GridItem As GridDataItem In DetailView.Items DetailFlag = False If GridItem.Selected = True Then DetailFlag = True Dim aryParameters(4) As String aryParameters(0) = "Delete" aryParameters(1) = GridItem.GetDataKeyValue("ObjectId") aryParameters(2) = GridItem.GetDataKeyValue("ObjectIdReferenced") aryParameters(3) = GridItem.GetDataKeyValue("ObjectSequence") USP_ExecuteSPNonQuery("IPSData", 20113, aryParameters) Exit For End If Next If DetailFlag = False Then ERR_SelectedRecord(Me) e.Canceled = "true" End If Case "AddParameters" If rgvIntranetObjects.SelectedValue Is Nothing Then ERR_SelectedRecord(Me) Else 'Execute Stored Procedure That Adds Parameters Dim SelectedRow As GridDataItem = DirectCast(rgvIntranetObjects.SelectedItems(0), GridDataItem) Dim intObjectId As Int32 = SelectedRow("ObjectId").Text End If Case "ShowParameters" If rgvIntranetObjects.SelectedValue Is Nothing Then ERR_SelectedRecord(Me) Else Dim SelectedRow As GridDataItem = DirectCast(rgvIntranetObjects.SelectedItems(0), GridDataItem) Dim intObjectId As Int32 = SelectedRow("ObjectId").Text Dim strPageHeading As String = "Object Id: " + intObjectId.ToString + " " + SelectedRow("ObjectName").Text Dim scriptstring As String = "parent.window.ShowRadWindow('/Modules/System/WBF SYS Intranet Object Parameters.aspx?ObjectId=" + intObjectId.ToString + "&PageHeading=" + strPageHeading + "', 620, 710);" ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "radwindow", scriptstring, True) End If End Select End If End Sub Private Sub rgvIntranetObjects_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgvIntranetObjects.ItemCreated 'Highlight Row On Mouse Over If TypeOf e.Item Is GridDataItem Then Dim Row As GridDataItem = DirectCast(e.Item, GridDataItem) USP_RowHighlighting(Row, "#E9E49D") End If 'Add Handler For Detail Table - Needed To Create Separate Scroll Bars For Detail Table If TypeOf e.Item Is GridNestedViewItem Then Dim nestedItem As GridNestedViewItem = TryCast(e.Item, GridNestedViewItem) AddHandler nestedItem.NestedViewCell.PreRender, AddressOf NestedViewCell_PreRender End If End Sub Private Sub rgvIntranetObjects_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgvIntranetObjects.ItemDataBound If TypeOf e.Item Is GridDataItem And e.Item.OwnerTableView.Name = "IntranetObjects" Then Dim Row As GridDataItem = DirectCast(e.Item, GridDataItem) 'If the width of the following fields is greater than the length of the column then set the tooltip text to 'the entire field value and truncate the actual field to only show 25 characters and ... If Row("ObjectPath").Text.Length > 30 Then Row("ObjectPath").ToolTip = Row("ObjectPath").Text.ToString() Row("ObjectPath").Text = (Row("ObjectPath").Text).Substring(0, 30) + " ... " End If If Row("ExportPath").Text.Length > 30 Then Row("ExportPath").ToolTip = Row("ExportPath").Text.ToString() Row("ExportPath").Text = (Row("ExportPath").Text).Substring(0, 30) + " ... " End If If Row("ObjectDescription").Text.Length > 30 Then Row("ObjectDescription").ToolTip = Row("ObjectDescription").Text.ToString() Row("ObjectDescription").Text = (Row("ObjectDescription").Text).Substring(0, 30) + " ... " End If End If 'Set the selected values of the Object Type and Object Module drop down lists to the actual values of the record being edited 'If not set then the selected value defaults to the first item in the list. If TypeOf e.Item Is GridEditFormItem AndAlso e.Item.IsInEditMode AndAlso e.Item.OwnerTableView.Name = "IntranetObjects" Then Dim GridItem As GridEditFormItem = DirectCast(e.Item, GridEditFormItem) Dim ddlModule As New DropDownList Dim ddlType As New DropDownList Dim txtModule As New TextBox Dim txtType As New TextBox ddlType = DirectCast(GridItem.FindControl("ddlObjectType"), DropDownList) ddlModule = DirectCast(GridItem.FindControl("ddlObjectModule"), DropDownList) txtType = DirectCast(GridItem.FindControl("txtObjectType"), TextBox) txtModule = DirectCast(GridItem.FindControl("txtObjectModule"), TextBox) ddlModule.SelectedValue = txtModule.Text ddlType.SelectedValue = txtType.Text End If 'Set the selected values of the Object Type and Reference Id combo boxes to the actual values of the record being edited 'If not set then the selected value defaults to the first item in the list. If e.Item.IsInEditMode AndAlso e.Item.OwnerTableView.Name = "ObjectsReferenced" Then Dim GridItem As GridEditableItem = DirectCast(e.Item, GridEditableItem) Dim rcbType As New RadComboBox Dim rcbObject As New RadComboBox Dim txtObjectType As New TextBox Dim txtObject As New TextBox Dim txtObjectName As New TextBox rcbType = DirectCast(GridItem("gtcObjectType").FindControl("rcbObjectType"), RadComboBox) rcbObject = DirectCast(GridItem("gtcObjectIdReferenced").FindControl("rcbReferencedId"), RadComboBox) txtObjectType = DirectCast(GridItem("ObjectTypeDetail").Controls(0), TextBox) txtObject = DirectCast(GridItem("ObjectIdReferenced").Controls(0), TextBox) txtObjectName = DirectCast(GridItem("ObjectName").Controls(0), TextBox) Me.SQLDS_References.SelectParameters.Clear() SQLDS_References.SelectParameters.Add("strCommandType", "Select") SQLDS_References.SelectParameters.Add("strObjectType", txtObjectType.Text) SQLDS_References.DataBind() rcbObject.DataSourceID = "SQLDS_References" rcbObject.DataBind() rcbType.SelectedValue = txtObjectType.Text rcbObject.Text = txtObjectName.Text rcbObject.SelectedValue = txtObject.Text ViewState("OldValueSequence") = DirectCast(GridItem("ObjectSequence").Controls(0), TextBox).Text ViewState("OldValueReference") = rcbObject.SelectedValue End If End Sub Private Sub rgvIntranetObjects_DeleteCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgvIntranetObjects.DeleteCommand If e.Item.OwnerTableView.Name = "IntranetObjects" Then Dim GridRow As GridDataItem = DirectCast(e.Item, GridDataItem) Dim strObjectId As String = GridRow.GetDataKeyValue("ObjectId").ToString Me.SQLDS_IntranetObjects.DeleteCommandType = SqlDataSourceCommandType.Text Me.SQLDS_IntranetObjects.DeleteCommand = "EXEC [System].[DSP_IntranetObjects-Sel-Ins-Upd-Del] 'Delete', '" & strObjectId + "'" End If End Sub Protected Sub rgvIntranetObjects_ItemDeleted(ByVal source As Object, ByVal e As Telerik.Web.UI.GridDeletedEventArgs) Handles rgvIntranetObjects.ItemDeleted If Not e.Exception Is Nothing Then Dim GridItem As GridDataItem = DirectCast(e.Item, GridDataItem) Dim strObjectId As String = GridItem.GetDataKeyValue("ObjectId").ToString() Dim strObjectName As String = GridItem("ObjectName").Text Dim strException As String = UDF_ConvertToJavaString(e.Exception.Message) e.ExceptionHandled = True ERR_Exception(Me, "deleted", strObjectId + " " + strObjectName, strException) End If End Sub Private Sub rgvIntranetObjects_InsertCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgvIntranetObjects.InsertCommand Dim intObjectId As Int32 = 0 If e.Item.OwnerTableView.Name = "IntranetObjects" Then Dim GridRow As GridEditFormInsertItem = DirectCast(e.Item.OwnerTableView.GetInsertItem(), GridEditFormInsertItem) Dim strObjectName As String = TryCast(GridRow.FindControl("txtObjectName"), TextBox).Text Dim strObjectType As String = TryCast(GridRow.FindControl("ddlObjectType"), DropDownList).SelectedValue Dim strObjectModule As String = TryCast(GridRow.FindControl("ddlObjectModule"), DropDownList).SelectedValue Dim strObjectDescription As String = TryCast(GridRow.FindControl("txtObjectDescription"), TextBox).Text Dim strObjectPath As String = TryCast(GridRow.FindControl("txtObjectPath"), TextBox).Text Dim strExportPath As String = TryCast(GridRow.FindControl("txtExportPath"), TextBox).Text If String.IsNullOrEmpty(strObjectName) Then ERR_NullValue(Me, "Object Name") ElseIf String.IsNullOrEmpty(strObjectType) Then ERR_NullValue(Me, "Object Type") Else Dim dr As SqlDataReader Dim aryParameter(22) As String Dim i As Integer 'Set All Parameters = Nothing For i = 0 To 21 aryParameter(i) = Nothing Next i 'Set Needed Parameters aryParameter(0) = "LastId" aryParameter(2) = strObjectType dr = UDF_GetSPDataReader("IPSData", 20093, aryParameter) While dr.Read() intObjectId = dr("LastId") + 1 End While dr.Close() Me.SQLDS_IntranetObjects.InsertCommandType = SqlDataSourceCommandType.Text Me.SQLDS_IntranetObjects.InsertCommand = "EXEC [System].[DSP_IntranetObjects-Sel-Ins-Upd-Del] 'Insert', '" + intObjectId.ToString + "', '" + strObjectType + "', '" + strObjectName + "', '" + strObjectModule + "', '" + strObjectPath + "', '" + strExportPath + "', '" + strObjectDescription + "',DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT, '" + Me.wucPageHeader.prpLogonUser + "'" End If Else Dim GridRowDetail As GridDataInsertItem = DirectCast(e.Item.OwnerTableView.GetInsertItem(), GridDataInsertItem) Dim ParentItem As GridDataItem = DirectCast(GridRowDetail.OwnerTableView.ParentItem, GridDataItem) Dim intReferenceId As Int32 = DirectCast(GridRowDetail.FindControl("rcbReferencedId"), RadComboBox).SelectedValue Dim strSequence As String = DirectCast(GridRowDetail("ObjectSequence").Controls(0), TextBox).Text Dim strDescription As String = DirectCast(GridRowDetail("ReferenceDescription").Controls(0), TextBox).Text intObjectId = ParentItem.GetDataKeyValue("ObjectId") Me.SQLDS_ObjectsReferenced.InsertCommandType = SqlDataSourceCommandType.Text Me.SQLDS_ObjectsReferenced.InsertCommand = "EXEC [System].[DSP_IntranetObjectsReferenced-Sel-Ins-Upd-Del] 'Insert', '" + intObjectId.ToString + "', '" + intReferenceId.ToString + "', '" + strSequence + "', '" + strDescription + "'" Dim DetailView As GridTableView = DirectCast(GridRowDetail.OwnerTableView, GridTableView) DetailView.Rebind() End If End Sub Private Sub rgvIntranetObjects_ItemInserted(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridInsertedEventArgs) Handles rgvIntranetObjects.ItemInserted If Not e.Exception Is Nothing Then Dim strException As String = UDF_ConvertToJavaString(e.Exception.Message) e.ExceptionHandled = True e.KeepInInsertMode = True ERR_Exception(Me, "inserted", "intranet object", strException) End If End Sub Private Sub rgvIntranetObjects_UpdateCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgvIntranetObjects.UpdateCommand Dim GridRow As GridEditableItem = TryCast(e.Item, GridEditableItem) Dim intObjectId As Int16 = GridRow.GetDataKeyValue("ObjectId") If e.Item.OwnerTableView.Name = "IntranetObjects" Then Dim strObjectName As String = TryCast(GridRow.FindControl("txtObjectName"), TextBox).Text Dim strObjectType As String = TryCast(GridRow.FindControl("ddlObjectType"), DropDownList).SelectedValue Dim strObjectModule As String = TryCast(GridRow.FindControl("ddlObjectModule"), DropDownList).SelectedValue Dim strObjectDescription As String = TryCast(GridRow.FindControl("txtObjectDescription"), TextBox).Text Dim strObjectPath As String = TryCast(GridRow.FindControl("txtObjectPath"), TextBox).Text Dim strExportPath As String = TryCast(GridRow.FindControl("txtExportPath"), TextBox).Text If String.IsNullOrEmpty(strObjectName) Then ERR_NullValue(Me, "Object Name") ElseIf String.IsNullOrEmpty(strObjectType) Then ERR_NullValue(Me, "Object Type") Else Me.SQLDS_IntranetObjects.UpdateCommandType = SqlDataSourceCommandType.Text Me.SQLDS_IntranetObjects.UpdateCommand = "EXEC [System].[DSP_IntranetObjects-Sel-Ins-Upd-Del] 'Update', '" + intObjectId.ToString + "', '" + strObjectType + "', '" + strObjectName + "', '" + strObjectModule + "', '" + strObjectPath + "', '" + strExportPath + "', '" + strObjectDescription + "',DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT, '" + Me.wucPageHeader.prpLogonUser + "'" End If Else Dim intReferenceId As Int32 = DirectCast(GridRow.FindControl("rcbReferencedId"), RadComboBox).SelectedValue Dim strSequence As String = DirectCast(GridRow("ObjectSequence").Controls(0), TextBox).Text Dim strDescription As String = DirectCast(GridRow("ReferenceDescription").Controls(0), TextBox).Text Me.SQLDS_ObjectsReferenced.UpdateCommandType = SqlDataSourceCommandType.Text Me.SQLDS_ObjectsReferenced.UpdateCommand = "EXEC [System].[DSP_IntranetObjectsReferenced-Sel-Ins-Upd-Del] 'Update', '" + intObjectId.ToString + "', '" + intReferenceId.ToString + "', '" + strSequence + "', '" + strDescription + "', DEFAULT, '" + ViewState("OldValueReference") + "', '" + ViewState("OldValueSequence") + "'" Dim DetailView As GridTableView = DirectCast(GridRow.OwnerTableView, GridTableView) DetailView.Rebind() End If End Sub Private Sub rgvIntranetObjects_ItemUpdated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridUpdatedEventArgs) Handles rgvIntranetObjects.ItemUpdated If Not e.Exception Is Nothing Then Dim EditedItem As GridEditableItem = DirectCast(e.Item, GridEditableItem) Dim strObjectId As String = TryCast(EditedItem.FindControl("txtObjectId"), TextBox).Text Dim strObjectName As String = TryCast(EditedItem.FindControl("txtObjectName"), TextBox).Text Dim strException As String = UDF_ConvertToJavaString(e.Exception.Message) e.KeepInEditMode = True e.ExceptionHandled = True ERR_Exception(Me, "updated", strObjectId + " " + strObjectName, strException) End If End Sub Private Sub NestedViewCell_PreRender(ByVal sender As Object, ByVal e As EventArgs) DirectCast(sender, Control).Controls(0).SetRenderMethodDelegate(New RenderMethod(AddressOf Me.NestedViewTable_Render)) End Sub Protected Sub NestedViewTable_Render(ByVal writer As HtmlTextWriter, ByVal control As Control) control.SetRenderMethodDelegate(Nothing) writer.Write("<div style='height: 350px; width: 1200px; overflow: scroll;'>") control.RenderControl(writer) writer.Write("</div>") End Sub End ClassI am posting the answer from your support ticket here for others encountering similar problems to see here. If you encounter any further issues, please post in the formal support thread, so that we avoid duplicate posts.
You are correct in your assumptions that the columns change visibility because the ItemCommand event does not run on the subsequent request and the columns visibility is taken from their declaration.
However, you could try using the SelectedIndexChanged event of the combos to ensure that the columns will remain visible. As this event could be fired (by user action) only when the combos are visible, you could be sure to set them to Visible="true" inside it. In order to access them, you could use the NamingContainer property of the combo to access the dataitem:
Protected Sub RadComboBox1_SelectedIndexChanged(sender As Object, e As RadComboBoxSelectedIndexChangedEventArgs) DirectCast(DirectCast(sender, RadComboBox).NamingContainer, GridEditableItemItem).OwnerTableView.GetColumn("ColUniqueName").Visible = TrueEnd SubAdditionally, if there are other postback actions that could cause the columns to hide, you could try saving a value in the ViewState and use it to control columns visibility depending on the latest command fired.
Regards,
Tsvetina
the Telerik team