Hi I have this EditItemTemplate which starts like this:
CODE
<fieldset>
<legend>Edit Order Template</legend>
<div class="px112">
destination / site:
</div>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("destinationID") %>' Width="165px"
Enabled="False"></asp:TextBox>
<asp:Label ID="lblDestinationName" runat="server" Text="destinationName:"></asp:Label>
<asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="SqlAllSites" DataTextField="destinationName"
DataValueField="siteID" SelectedValue='<%# Eval("destinationID") %>' Enabled="False">
</asp:DropDownList>
<br />
<fieldset>
<legend>Update Destination</legend>
<asp:Label ID="Label2" runat="server" Text="To change destination, first select site type:"></asp:Label>
<asp:ObjectDataSource ID="ods_Sites" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="GetSiteTypes" TypeName="dsSiteTypesTableAdapters.SiteType_SelectTableAdapter"
OnSelecting="ods_Sites_Selecting"></asp:ObjectDataSource>
<asp:DropDownList ID="ddSiteTypes" runat="server" AppendDataBoundItems="True" DataSourceID="ods_Sites"
DataTextField="siteType" DataValueField="siteTypeID" Width="170px" ToolTip="Select site type .."
Height="23px">
<asp:ListItem Value="-1">Site type...</asp:ListItem>
</asp:DropDownList>
<asp:Label ID="Label1" runat="server" Text="new Destination Name"></asp:Label>
<asp:DropDownList ID="ddDestinationName" runat="server" DataSourceID="SqlAllSites"
DataTextField="destinationName" DataValueField="siteID" OnSelectedIndexChanged="ddDestinationName_SelectedIndexChanged">
</asp:DropDownList>
<asp:Button ID="buttUpdateDestination" runat="server" OnClick="buttUpdateDestination_Click"
Text="Update Destination" />
<ajaxToolkit:CascadingDropDown ID="CascadingDropDown2" runat="server" Category="SiteType"
LoadingText="Please wait..." ParentControlID="ddSiteTypes" PromptText="Select a destination"
TargetControlID="ddDestinationName" ServicePath="sloDestinationService.asmx"
ServiceMethod="GetSloDestinations" />
</fieldset>
It starts with a text box showing the value of the field DestinationID.The next field is a DropDownList which displays the Destination Name linked to the ame value field DestinationID (SiteID).Next, there are two Cascading Drop Down boxes in the fieldset called Update Destination. The user chooses a Site Type. Then the list of destinations in ddDestinationName is changed to suit. The user chooses the destination name from the second Drop Down box, the clicks on the Update Destination button.That runs this code:
CODE
DropDownList myList = (DropDownList)fvSingleLineOrders.FindControl("ddDestinationName");
int number = Convert.ToInt32(myList.SelectedValue);
TextBox myText = (TextBox)fvSingleLineOrders.FindControl("TextBox1");
myText.Text = myList.SelectedValue;
Followed by this:
CODE
gvSingleLineOrders.DataSourceID = "SqlSingleLineOrderList";
gvSingleLineOrders.DataBind();
In testing, TextBox1 is being updated with the new value, but it is not reflected in the value displayed in DropDownList2 even though DestinationID should now be changed. Then, when the Update Order button is pressed, the database is not being updated. All other fields on the form update OK.
1. How do I make it update destinationID (the field bound to TextBox1)?
2. How do I get it to display the new value in DropDownList2?
Stapes