When I add a record the user selects a customer - I then want the category dropdown to populate based on which customer is selected. I cannot seem to get this to work. Please advise.
ASPX Code -
<
asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div align="center" style="width: 100%">
<
br />
<
table style="width: 100%">
<tr>
<td align="right" style="width: 25%">
<asp:Label ID="Label1" runat="server" Text="Customer:" SkinID="mediumlbl"></asp:Label> </td>
<td align="left" style="width: 25%">
<asp:DropDownList ID="dropCustomer" runat="server" SkinID="RegDrop"
AutoPostBack="True">
</asp:DropDownList>
</td>
<td align="right" style="width: 25%">
<asp:Label ID="Label4" runat="server" Text="Active:" SkinID="mediumlbl"></asp:Label> </td>
<td align="left" style="width: 25%">
<asp:DropDownList ID="dropActive" runat="server" SkinID="RegDrop"
AutoPostBack="True">
<asp:ListItem Selected="True" Value="1">Active</asp:ListItem>
<asp:ListItem Value="0">Deleted</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</table>
<
hr />
<asp:Label ID="lblError" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
<br />
<table style="width: 80%" align="center">
<tr>
<td align="left">
<asp:Button ID="btnExcel" runat="server" Text="Export to Excel" />
</td>
<td align="center">
<asp:Button ID="btnWord" runat="server" Text="Export to Word" />
</td>
<td align="right">
<asp:Button ID="btnCSV" runat="server" Text="Export to CSV" />
</td>
</tr>
</
table>
<
br />
<telerik:RadGrid ID="RadCustomerParts" runat="server" AllowSorting="True"
GridLines="None" Skin="WebBlue"
DataSourceID="dsCustomerParts" OnItemCommand="RadCustomerParts_ItemCommand"
AutoGenerateColumns="False" AllowPaging="True" PageSize="20"
AllowFilteringByColumn="True" >
<GroupingSettings CaseSensitive="false" />
<
HeaderContextMenu>
<
CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</
HeaderContextMenu>
<
GroupingSettings CaseSensitive="False"></GroupingSettings>
<ExportSettings ExportOnlyData="True" FileName="Customer Parts"
IgnorePaging="True" OpenInNewWindow="True">
</ExportSettings>
<
MasterTableView EditMode="PopUp" CommandItemDisplay="Top" DataKeyNames="CustomerPartNumberID" DataSourceID="dsCustomerParts" >
<CommandItemTemplate>
<table>
<tr>
<td width="10%">
<asp:LinkButton ID="btnAddNewItem" Text="Add new item"
Runat="server" CommandName="InitInsert"></asp:LinkButton>
</td>
<td width="80%">
</td>
<td width="10%">
<asp:LinkButton ID="btnRefresh" Text="Refresh data" CommandName="Rebind" Runat="server"></asp:LinkButton>
</td>
</tr>
</table>
</CommandItemTemplate>
 
<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 colspan="2" style="font-size: small">
<b>Customer Part Details</b></td>
</tr>
<tr>
<td>
<table id="Table3" cellspacing="1" cellpadding="1" width="98%" border="0" >
<tr>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
Customer ID:
</td>
<td>
<asp:DropDownList ID="DropCustEdit" runat="server" SelectedValue='<%# Bind("CustomerID") %>'
DataSourceID="dsCustomerDrop" DataTextField="Name"
DataValueField="CustomerID" TabIndex="1" AppendDataBoundItems="True" >
<asp:ListItem Selected="True" Text="Select Customer" Value="0"></asp:ListItem>
</asp:DropDownList>
<span style="color: Red">*</span>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5"
ControlToValidate="DropCustEdit" ErrorMessage="This field is required" runat="server" InitialValue="0"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td>
Part Number:
</td>
<td>
<asp:TextBox ID="txtpartnumber" runat="server" Text='<%# Bind( "PartNumber") %>' TabIndex="2">
</asp:TextBox>
<span style="color: Red">*</span>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4"
ControlToValidate="txtpartnumber" ErrorMessage="This field is required" runat="server"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
Part Description:
</td>
<td>
<asp:TextBox ID="txtDesc" runat="server" Text='<%# Bind( "Description") %>' TabIndex="3">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
UOM:
</td>
<td>
<asp:DropDownList ID="dropUOM" runat="server" SelectedValue='<%# Bind("UnitOfMeasureCD") %>'
DataSourceID="dsUOM" DataTextField="Description" DataValueField="UnitofMeasureCD" TabIndex="4" AppendDataBoundItems="True">
<asp:ListItem Selected="True" Text="Select" Value=""></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
Category:
</td>
<td>
<asp:DropDownList ID="DropCategory" runat="server"
DataSourceID="dsCustomerCategory" DataTextField="Category" TabIndex="5"
DataValueField="Category" >
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
Length:
</td>
<td>
<asp:TextBox ID="txtLength" runat="server" TabIndex="6"
Text='<%# Bind( "Length") %>'>
</asp:TextBox>
</td>
</tr>
<tr>
<td>
Height:
</td>
<td>
<asp:TextBox ID="txtHeight" runat="server" Text='<%# Bind( "Height") %>' TabIndex="7">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
Width:
</td>
<td>
<asp:TextBox ID="txtWidth" runat="server" Text='<%# Bind( "Width") %>' TabIndex="8">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
Weight:
</td>
<td>
<asp:TextBox ID="txtWeight" runat="server" Text='<%# Bind( "Weight") %>' TabIndex="9">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
Manufacturer:
</td>
<td>
<asp:TextBox ID="txtManu" runat="server" Text='<%# Bind( "Manufact") %>' TabIndex="10">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
Alt Ref #:
</td>
<td>
<asp:TextBox ID="txtAltRef" runat="server" Text='<%# Bind( "AltRefOne") %>' TabIndex="11">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
Serialized:
</td>
<td>
<asp:CheckBox ID="chkSerial" Checked='<%# Bind("Serialized") %>' runat="server" TabIndex="12" />
</td>
</tr>
<tr>
<td>
Parts Quantity Per Unit:
</td>
<td>
<asp:TextBox ID="txtPQPU" runat="server" Text='<%# Bind( "PartQuantityPerUnit") %>' TabIndex="13">
</asp:TextBox>
<span style="color: Red">*</span>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3"
ControlToValidate="txtPQPU" ErrorMessage="This field is required" runat="server"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td>
Quantity Alert Minimum:
</td>
<td>
<asp:TextBox ID="txtMin" runat="server" Text='<%# Bind( "QuantityAlertMinimum") %>' TabIndex="14">
</asp:TextBox>
<span style="color: Red">*</span>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2"
ControlToValidate="txtMin" ErrorMessage="This field is required" runat="server"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
Quantity Alert Maximum:
</td>
<td>
<asp:TextBox ID="txtMax" runat="server" Text='<%# Bind( "QuantityAlertMaximum") %>' TabIndex="15">
</asp:TextBox>
<span style="color: Red">*</span>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
ControlToValidate="txtMax" ErrorMessage="This field is required" runat="server"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td>
Special Instructions:
</td>
<td>
<asp:TextBox ID="txtSpecial" runat="server" Text='<%# Bind( "SpecialInstructions") %>' TabIndex="16" TextMode="MultiLine" Width="250px">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
Active:
</td>
<td>
<asp:CheckBox ID="chkActive" Checked='<%# Bind("Active") %>' runat="server" TabIndex="17" />
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnUpdatep2" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'
runat="server"
CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>'
TabIndex="17" >
</asp:Button>
</td>
<td>
<asp:Button ID="btnCancel" CommandName="Cancel" runat="server" Text="Cancel" CausesValidation="false" TabIndex="18" />
</td>
</tr>
</table>
</td>
<td>
</td>
</tr>
</table>
</FormTemplate>
</EditFormSettings>
<%
--<CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>--%>
<%
--<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>--%>
<
RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
<
ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
<Columns>
<telerik:GridButtonColumn ButtonType="PushButton"
CommandName="Edit" Text="Edit" UniqueName="EditPart">
</telerik:GridButtonColumn>
<telerik:GridButtonColumn ButtonType="PushButton" ConfirmText="Delete this part?"
CommandArgument="CustomerPartNumberID" CommandName="Delete" Text="Delete"
UniqueName="DeletePart">
</telerik:GridButtonColumn>
<telerik:GridBoundColumn ReadOnly="True" DataField="CustomerPartNumberID"
UniqueName="CustomerPartNumberID" DataType="System.Int32"
HeaderText="CustomerPartNumberID" SortExpression="CustomerPartNumberID" Visible="false" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CustomerID" UniqueName="CustomerID" Visible="true" HeaderText="Customer ID" DataType="System.Int32" SortExpression="CustomerID" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CustomerName" UniqueName="CustomerName" Visible="true" HeaderText="Customer" Readonly="true" SortExpression="CustomerName" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="PartNumber" UniqueName="PartNumber"
Visible="True" HeaderText="Part Number"
SortExpression="PartNumber" AllowFiltering="true" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Description" HeaderText="Description"
SortExpression="Description" UniqueName="Description" AllowFiltering="false" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="AltRefOne" HeaderText="Alt Ref #"
SortExpression="AltRefOne" UniqueName="AltRefOne" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Serialized" UniqueName="Serialized"
Visible="True" HeaderText="Serialized" DataType="System.Byte"
SortExpression="Serialized" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Category" HeaderText="Cat" SortExpression="Category"
UniqueName="Category" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="UOM" HeaderText="UOM" SortExpression="UOM"
UniqueName="UOM" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Height" HeaderText="Height"
SortExpression="Height" UniqueName="Height" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Length" HeaderText="Length"
SortExpression="Length" UniqueName="Length" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Width" HeaderText="Width"
SortExpression="Width" UniqueName="Width" AllowFiltering="false" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Weight" HeaderText="Weight"
SortExpression="Weight" UniqueName="Weight" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="UnitOfMeasureCD" HeaderText="UnitOfMeasureCD" SortExpression="UnitOfMeasureCD"
UniqueName="UOMCD" Visible="false" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="PartQuantityPerUnit" UniqueName="PartQuantityPerUnit"
Visible="False" HeaderText="Part Quantity Per Unit" DataType="System.Int32"
SortExpression="PartQuantityPerUnit" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="QuantityAlertMinimum" UniqueName="QuantityAlertMinimum"
Visible="False" HeaderText="Quantity Alert Minimum" DataType="System.Int32"
SortExpression="QuantityAlertMinimum" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="QuantityAlertMaximum"
DataType="System.Int32" HeaderText="Quantity Alert Maximum"
SortExpression="QuantityAlertMaximum" UniqueName="QuantityAlertMaximum"
Visible="False" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="SpecialInstructions"
HeaderText="Special Instructions" SortExpression="SpecialInstructions"
UniqueName="SpecialInstructions" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Manufact" HeaderText="Manufacturer"
SortExpression="Manufact" UniqueName="Manufacturer" AllowFiltering="false">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn DataField="Active" DataType="System.Byte"
HeaderText="Active" SortExpression="Active" UniqueName="TempActive" AllowFiltering="false">
<ItemTemplate>
<asp:CheckBox ID="chkActive" runat="server" Checked='<%# eval("Active") %>' />
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
 
</
MasterTableView>
<
FilterMenu>
<
CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</
FilterMenu>
</telerik:RadGrid>
 
 
<asp:SqlDataSource ID="dsCustomerParts" runat="server"
ConnectionString="<%$ ConnectionStrings:HDN_ConnectionString %>"
SelectCommand="sp_CPMSCustomerPartNumbersByCustomerIDByBusinessType"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="dropCustomer" Name="CustomerID"
PropertyName="SelectedValue" Type="Int32" />
<asp:ControlParameter ControlID="dropActive" DefaultValue="1" Name="Active"
PropertyName="SelectedValue" Type="Byte" />
<asp:SessionParameter DefaultValue="6" Name="BusinessTypeID"
SessionField="BusinessTypeID" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
 
 
<asp:SqlDataSource ID="dsCustomerDrop" runat="server"
ConnectionString="<%$ ConnectionStrings:HDN_ConnectionString %>"
SelectCommand="sp_CPMSCustomerDropByBusinessType"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:SessionParameter DefaultValue="6" Name="BusinessTypeID"
SessionField="BusinessTypeID" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
 
 
<asp:SqlDataSource ID="dsCustomerCategory" runat="server"
ConnectionString="<%$ ConnectionStrings:HDN_ConnectionString %>"
SelectCommand="sp_CPMCustomerCategoryDrop" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="dropCustomer" Name="CustomerID"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
 
 
<asp:SqlDataSource ID="dsUOM" runat="server"
ConnectionString="<%$ ConnectionStrings:HDN_ConnectionString %>"
SelectCommand="sp_UnitofMeasureDrop" SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
 
VB Code -
Protected Sub RadCustomerParts_selectedIndexChanged(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadCustomerParts.SelectedIndexChanged
If TypeOf e.Item Is GridDataItem Then
Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem)
Dim ddList As DropDownList = CType(editedItem("dropcategory").Controls(0), DropDownList)
ddList.DataSource = dsCustomerCategory
ddList.DataBind()
 
End If