If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem) Dim Manufacturers As RadComboBox = CType(editedItem.FindControl("ManufacturerEdit"), RadComboBox) ProductsAccess.BindManufacturers(Manufacturers) 'Dim Manufacturer As Integer = DataBinder.Eval(editedItem.DataItem, "Manufacturer").ToString 'Manufacturers.SelectedValue = Manufacturer Dim Categories As RadComboBox = CType(editedItem.FindControl("CategoryEdit"), RadComboBox) ProductsAccess.BindCategories(Categories) 'Dim Category As Integer = DataBinder.Eval(editedItem.DataItem, "Category").ToString 'Categories.SelectedValue = CategoryIf TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem) Dim Manufacturers As RadComboBox = CType(editedItem.FindControl("ManufacturerEdit"), RadComboBox) ProductsAccess.BindManufacturers(Manufacturers) Dim Manufacturer As Integer = DataBinder.Eval(editedItem.DataItem, "Manufacturer").ToString Manufacturers.SelectedValue = Manufacturer Dim Categories As RadComboBox = CType(editedItem.FindControl("CategoryEdit"), RadComboBox) ProductsAccess.BindCategories(Categories) Dim Category As Integer = DataBinder.Eval(editedItem.DataItem, "Category").ToString Categories.SelectedValue = CategoryProductsAccess.BindManufacturers(Manufacturers)
is a pretty simple Sub that bind combobox to datatable. I even tried
with iterating DataRows in the DataTable.Rows collection and populating
the combo one by one. The problem persisted :( foreach (HtmlTableRow row in uc.RecommendationTable.Rows)
{
var rec1 = (RadTextBox)row.Cells[1].Controls[0];
}
i basically want to avoid having to use any find controls or anything because there are like 20 rows of 4 columns. I want to iterate through each row and give me the value of the control located in each column of the HTML table.
In the following extracted code, column 'Id' is not visible at all times. Column 'AE' should be invisible, too. However, column 'AE' appears in the EditForm despite event ItemDataBound event which sets both columns Visible = False.
How can I hide column AE?
<telerik:RadGrid ID="rgHeader" runat="server" CellSpacing="0" DataSourceID="sdsHeader">
<MasterTableView AutoGenerateColumns="False" CommandItemDisplay="Top" DataSourceID="sdsHeader">
<CommandItemSettings ExportToPdfText="Export to PDF" AddNewRecordImageUrl="Images/new.png" AddNewRecordText="Add Header"></CommandItemSettings>
<Columns>
<telerik:GridButtonColumn Text="Select" CommandName="Select" UniqueName="Select" ItemStyle-Width="30px"></telerik:GridButtonColumn>
<telerik:GridEditCommandColumn></telerik:GridEditCommandColumn>
<telerik:GridBoundColumn DataField="AE" HeaderText="AE" SortExpression="AE" UniqueName="AE"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Total" DataType="System.Int32" HeaderText="Total"
SortExpression="Total" UniqueName="Total">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Id" DataType="System.Int32" HeaderText="Id" ReadOnly="True"
SortExpression="Id" UniqueName="Id">
</telerik:GridBoundColumn>
</Columns>
<EditFormSettings>
<EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn1 column"></EditColumn>
</EditFormSettings>
</MasterTableView>
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
</telerik:RadGrid>
Protected Sub rgHeader_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles rgHeader.ItemDataBound
rgHeader.MasterTableView.GetColumn(
"Id").Visible = False
rgHeader.MasterTableView.GetColumn(
"AE").Visible = False
End Sub
<
telerik:RadGrid runat="server"
ID="grdActions"
AllowPaging="false"
Width="750px"
AutoGenerateColumns="false"
Skin="Office2007"
DataSourceID="TaskActionsDataSource"
OnPreRender="grdActions_PreRender"
OnItemCommand="grdActions_ItemCommand"
OnRowDrop="grdActions_RowDrop"
OnItemDataBound="grdActions_ItemDataBound"
>
<ClientSettings EnableAlternatingItems="true"
EnableRowHoverStyle="true"
AllowExpandCollapse="false"
AllowRowsDragDrop="true"
>
<Selecting AllowRowSelect="True" />
</ClientSettings>
<MasterTableView DataKeyNames="Id" TableLayout="Fixed"
AllowMultiColumnSorting="false"
AllowFilteringByColumn="false"
AlternatingItemStyle-BackColor="#F2F3F5"
>
<DetailTables>
<telerik:GridTableView HeaderStyle-BackColor="Beige" CommandItemStyle-BackColor="Beige"
Name="DetailsTable"
DataSourceID="ActionModuleCollectionDataSource"
DataKeyNames="Id"
AutoGenerateColumns="false"
CommandItemDisplay="Top"
TableLayout="Fixed"
HeaderStyle-CssClass="hideGridHeader"
NoDetailRecordsText="There is no training, meeting or procurement attached to the action above"
CssClass="detailGridMargin"
>
<CommandItemTemplate>
<div style="padding: 5px 5px;">
<asp:LinkButton ID="btnAddTraining" runat="server" CommandName="AddTraining" Font-Names="Tahoma" Font-Size="11px"><img style="border:0px; width: 25px; height: 17px; vertical-align:middle;" alt="" src="../Images/add_training.png" />Add Training</asp:LinkButton>
<asp:LinkButton ID="btnAddMeeting" runat="server" CommandName="AddMeeting" Font-Names="Tahoma" Font-Size="11px"><img style="border:0px; width: 25px; height: 17px; vertical-align:middle;" alt="" src="../Images/add_meeting.png" />Add Meeting</asp:LinkButton>
<asp:LinkButton ID="btnAddProcurement" runat="server" CommandName="AddProcurement" Font-Names="Tahoma" Font-Size="11px"><img style="border:0px; width: 25px; height: 17px; vertical-align:middle;" alt="" src="../Images/add_procurement.png" />Add Procurement</asp:LinkButton>
</div>
</CommandItemTemplate>
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="Id" MasterKeyField="Id" />
</ParentTableRelation>
<Columns>
<telerik:GridBoundColumn UniqueName="ModuleType" DataField="ModuleType" HeaderStyle-Width="100px"></telerik:GridBoundColumn>
<telerik:GridHyperLinkColumn UniqueName="meetingurl"
DataTextField="Title" DataNavigateUrlFields="Id" DataNavigateUrlFormatString="../Meeting/Meeting.aspx?actionId={0}&ViewMode=ReadOnly"
>
</telerik:GridHyperLinkColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
<Columns>
<telerik:GridBoundColumn
DataField="SortCode"
Visible="true"
HeaderText="#"
HeaderStyle-Width = "30"
ItemStyle-Font-Bold="true"
ItemStyle-Font-Names="Tahoma"
>
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn UniqueName="TemplateColumn" InitializeTemplatesFirst="false">
<HeaderTemplate>
<table id="Table1" cellspacing="0" cellpadding="0" border="0">
<tr>
<td colspan="0">
<b>Action Details</b>
</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td style="border-width: 0px;"><input type="hidden" id="hiddenActionId" value="<%# Eval("Id") %>" /></td>
</tr>
<tr>
<td colspan="6" style="width: 200px; font-size: 12px; font-family: Tahoma;">
<b>Name: </b><%# Eval("Description") %> (<%# Eval("TypeName") %>) <%# Convert.ToBoolean(Eval("Location").Equals("")) ? "" : ":: " + Eval("Location")%>
</td>
<td align="right">
<img src="../images/status_<%# Eval("StatusName")%>.png" alt="<%# Eval("StatusName")%>" />
</td>
</tr>
<tr>
<td colspan="4" style="width: 250px; font-size: 12px; font-family: Tahoma;">
<b>Output: </b> <%# Eval("Output") %>
</td>
<td rowspan="3" style="width: 50px; font-size: 12px; font-family: Tahoma;" align="center">
<img src="../images/status_<%# Convert.ToBoolean(Eval("NoBudgetFlag")) ? "nobudget" : "budget" %>.png"
alt='<%# Convert.ToBoolean(Eval("NoBudgetFlag")) ? "No budget required for this action" : "Budget estimation required for this action" %>' />
</td>
<td colspan="2" rowspan="3" style="width: auto; font-size: 12px; font-family: Tahoma;" align="center">
$ <%
# Eval("TotalEstimationInDollar") %> <%# Eval("TotalEstimationInEuro") %>
<br />
<%
if (iViewBudget == 0)
{ %>
<a href="#" onclick="openRadWindowEstimation('<%# DataBinder.Eval(Container.DataItem, "Id") %>'); return false;" id="linkEstimation" class="smallFont" style="font-size: 9px; font-weight:bold; font-family: Tahoma; color: #0099FF;">[VIEW/MODIFY BUDGET]</a><% } %>
</td>
</tr>
<tr>
<td colspan="4" style="font-size: 12px; font-family: Tahoma;">
<b>Date: </b> <%# Eval("StartDate") %> <%# Convert.ToBoolean(Eval("CompletionDate").Equals("")) ? "" : " to " + Eval("CompletionDate") %>
</td>
</tr>
<tr>
<td colspan="4" style="font-size: 12px; font-family: Tahoma;">
<b>Comment: </b> <%# Eval("Comment") %>
</td>
</tr>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script language="javascript" type="text/javascript">
function RefreshFinancialRelatedGrids(RadWindow) {
$find(
'<%=this.RadAjaxManager1.ClientID%>').ajaxRequest("Rebind");
}
function openRadWindowEstimation(actionId) {
// var lnkProbisWindow = document.getElementById("ctl00_messagePanelsContent_contentPlaceHolder_fvTaskDetail_linkEstimation");
// var hdnViewmodifyBudget = document.getElementById("ctl00_messagePanelsContent_contentPlaceHolder_fvTaskDetail_hdnViewmodifyBudget");
//
// if (hdnViewmodifyBudget.value == "1")
// lnkProbisWindow.enabled = false;
// else {
var oWnd = radopen("Task_Estimation.aspx?actionid=" + actionId + "&disableMaster=1", "RadWindowTaskEstimation");
oWnd.Center();
//}
}
</script>
</telerik:RadCodeBlock>
<telerik:RadWindowManager ID="RadWindowManagerTaskEstimation" runat="server" Modal="true">
<Windows>
<telerik:RadWindow ID="RadWindowTaskEstimation" runat="server"
DestroyOnClose="true" Modal="true"
Skin="Vista" Animation="None" ShowContentDuringLoad="false" VisibleStatusbar="false"
KeepInScreenBounds="true" Width="1000px" Height="750px" Behavior="Close" />
</Windows>
</telerik:RadWindowManager>
</table>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
Webpage error detailsUser Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB6.6; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 1.1.4322; .NET CLR 3.5.21022; InfoPath.2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)Timestamp: Wed, 13 Jul 2011 16:42:09 UTCMessage: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 405Line: 6Char: 84093Code: 0URI: http://www.nirvanawebworks.com/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d4.0.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3a1f68db6e-ab92-4c56-8744-13e09bf43565%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2011.1.519.40%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3a911e11b9-43a3-4153-a0e1-a8dd325e7573%3a16e4e7cd%3af7645509%3a24ee1bba%3af46195d3%3a1e771326%3aaa288e2d%3ab7778d6c%3a11e117d7%3a7165f74<telerik:RadComboBox ID="ddlOwnProjects" runat="server" DataTextField="Name" MarkFirstMatch="true" AutoPostBack="true" Width="180px" EnableEmbeddedSkins="false" Skin="DefaultGBT" DataValueField="Id" LoadingMessage="<%$ Resources:PGC, General_LoadingText %>" EmptyMessage="<%$ Resources:PGC, General_DdlPleaseSelectTitle %>" OnSelectedIndexChanged="ddlOwnProjects_SelectedIndexChanged" AppendDataBoundItems="true" Visible="true"> <Items> <telerik:RadComboBoxItem Text="<%$ Resources:PGC, General_DdlPleaseSelectTitle %>" Value="None" Selected="true" Enabled="false" /> </Items> </telerik:RadComboBox>