I have an ASP.NET web form with a gridview being dynamically populated by a datasource. There are three columns in the gridview, the first Column1, is an ID column which is hidden from view (ProgramID). The second, Column2, contains a name, which when in edit mode, converts to a textbox (ProgramName). The third (and the piece I need help with), Column3, lists a Name (SiteName), and when in edit mode, produces a dropdownlist. The selected value of this dropdownlist is bound to the ID of this name (not the name itself - this is SiteID). All of this comes out of the stored proc tied to the select function for the gridview.
Now here is where I need help. Column3, when edited, turns into a drop down list. This drop down list needs to display Site Names and IDs, which are contained in a different stored procedure. So, while the overall gridview is filling from one stored procedure, along with the actual current valuie of Column3, I want the user to be able to edit that 3rd column, and have their list of available choices come from the filling of that dropdownlist from another stored procedure. In less complicated terms, **can you individually bind elements within an edittemplate to stored procedures that are not the primary select procedure**? The IDs that would populate this dropdown list would obviously correspond to the update ID that would go in the update procedure, I dont need to fire a separate stored proc for that.
Below is my code, hopefully it makes sense. Everything works EXCEPT the dropdown list for column 3 populating. (this is ddlSiteAssociation)
<asp:GridView ID="gvCurrentPrograms" runat="server" AutoGenerateColumns="False
ShowHeader="True" BorderColor="#000000" BorderStyle="solid" BorderWidth="1px" Width="500px"
DataSourceID="dsPrograms" DataKeyNames="ProgramID, SiteID" RowStyle-BackColor="#def5f
<table width="498px"><tr><td style="background-color:Wh
src="images/caution.gif" /> No programs currently set for that site.</td></tr></table>
<asp:CommandField ShowEditButton="true" ButtonType="Button" />
<asp:BoundField DataField="ProgramID" HeaderText="ID" ReadOnly="true" Visible="false"/>
<asp:TemplateField HeaderText="Program Name">
<asp:TextBox ID="txtProgramName" runat="server" Text='<%#Bind("ProgramName
<asp:Label ID="lblProgramName" runat="server" Text='<%# Eval("ProgramName") %>' />
<asp:TemplateField HeaderText="Site Association">
<asp:DropDownList ID="ddlSiteAssociation" runat="server" SelectedValue='<%#Bind("Si
<asp:Label ID="lblSiteAssociation" runat="server" Text='<%# Eval("SiteName") %>' />
SelectCommand = "uspGetCurrentPrograms"
UpdateCommand = "uspUpdateProgram"
ConnectionString="<%$ ConnectionStrings:Conn %>"
<asp:Parameter Name="SiteID" Type="Int32" DefaultValue="" />