An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
|
I am trying to use the Selected index of one RadComboBox help build the query to populate another RadComboBox, they are both in the <EditItemTemplate>.
I get an Object reference not set to instance of an object when I run this code just adding a RadComboBoxItem without even building the query.
Protected Sub ItemType_SelectedIndexChanged(ByVal o As Object, ByVal e As RadComboBoxSelectedIndexChangedEventArgs) Dim DDL As RadComboBox = TryCast(RadGrid1.FindControl("FlatFileType").Controls(0), RadComboBox) Dim RadComboBoxItem1 As New RadComboBoxItem("First Item") DDL.Items.Add(RadComboBoxItem1)End SubI am not sure how to correctly access the second radcombobox to be able to populate it.
Any help is greatly appreciated.
DataFormatString="{0:MM/dd/yyyy}" to make time invisible.<telerik:GridBoundColumn HeaderText="ETA Date" UniqueName="ETA_Date" DataField="ETA_Date" DataFormatString="{0:MM/dd/yyyy}" ReadOnly="true" SortExpression="ETA_Date" > <HeaderStyle Font-Bold="True" Wrap="False" HorizontalAlign="Center"></HeaderStyle> <ItemStyle Wrap="False" HorizontalAlign="Center"></ItemStyle></telerik:GridBoundColumn>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