passing ddl value to update in gridview


Joined
Nov 9, 2007
Messages
2
Reaction score
0
Hi, i have a datagrid from SqlDataSource1 where on 'edit' a ddl is populated by SqlDataSource2. im trying to get the selected value to pass for an update of SqlDataSource1.

<asp:TemplateField HeaderText="CurrentAssignment">
<ItemTemplate>
<%# Eval("CurrentAssignment") %>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ddlAssignTo" runat="server" DataSourceID="SqlDataSource2" DataTextField="windowslogin" DataValueField="windowslogin")></asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:Test %>"
SelectCommand="SELECT [windowslogin] FROM [AllAssignmentList]order by[windowslogin]">
</asp:SqlDataSource>
</EditItemTemplate>
</asp:TemplateField>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Test %>"
SelectCommand="SELECT [EndorsementID], [CurrentAssignment], [Priority], [Account#]FROM [EndorsementRequests] WHERE ([CurrentAssignment] = @CurrentAssignment) ORDER BY [Account#]"
UpdateCommand="UPDATE EndorsementRequests SET CurrentAssignment = @CurrentAssignment WHERE (EndorsementID = @original_EndorsementID)">
<SelectParameters>
<asp:parameter DefaultValue="SafeArea" Name="CurrentAssignment" Type="String" />
</SelectParameters>
<UpdateParameters>
<asp:parameter Name="original_EndorsementID" Type="Int32" />
<asp:ControlParameter Name="CurrentAssignment" ControlID="GridView1$ddlAssignTo" PropertyName="SelectedValue" /></UpdateParameters>


The issues appears to be with the scope since I get a "Could not find control 'GridView1$ddlAssignTo' in ControlParameter 'CurrentAssignment'" error. but i dont see why "GridView1$ddlAssignTo" is not working. thanks for the help
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top