WhereParameter is not working for dropdownlist - asp.net

My Table structure
Courses
Id
Description
Subjects
Id
Description
Courses (Relation to Courses table).
My code as follows
td>
<asp:DropDownList ID="ddlCourses" runat="server" DataSourceID="LinqCourses"
DataTextField="Description" DataValueField="Id"/>
<asp:LinqDataSource ID="LinqCourses" runat="server"
ContextTypeName= "DataAccess.SchoolStudyDataContext" Select="new (Description, Id)"
TableName="Courses" />
</td>
<td align="left" valign="top" class="style5" style="width: 124px">
<asp:DropDownList ID="ddlSubjects" runat="server" DataSourceID="LinqSubjects"
DataTextField="Description" DataValueField="Id"/>
<asp:LinqDataSource ID="LinqSubjects" runat="server"
ContextTypeName= "DataAccess.SchoolStudyDataContext" Select="new (Description,Courses,Id)"
TableName="Subjects" Where="Courses == #Id" />
<WhereParameters>
asp:ControlParameter ControlID="ddlCourses" Name="Id"
PropertyName="SelectedValue" Type="Int32" />
</WherePrameters>

<asp:DropDownList ID="ddlCourses" runat="server" DataSourceID="SqlDataSource1"
DataTextField="Description" DataValueField="Id"/>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ProjectConnectionString %>"
SelectCommand="SELECT [Description],[Courses],[Id] FROM [table_name] WHERE ([Courses ] = #Courses ) ">
<SelectParameters>
<asp:Parameter Name="Courses" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
This is not a exact answer but this might help i guess

Your Where Property is wrong. Change this (==):
Where="Courses == #Id" />
To this (=):
Where="Courses = #Id" />
Source: MSDN

Related

Server Error in '/' Application. A ControlID must be specified in ControlParameter 'Product_Name'

I am new here and a beginner with APS and VB, I do have SQL experience. the problem I am having is I am trying to select two values in a VB aspx page.
one is a text box which can be types into, the other is a value which is selected from a drop downlist that looks as a table in my SQL database.
I want both values once entered and selected to be entered as a new row into another table of the same database, but I am getting the following error. and its driving me round in circles.
A ControlID must be specified in ControlParameter 'Product_Name'.
my code is as below, I suspect it is something simple that I am missing but I cannot see it for looking, can anyone help please?
<table style="width:100%;">
<tr>
<td>
<asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1" DefaultMode="Insert">
<InsertItemTemplate>
Product_Name:
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource2" DataTextField="Product_Name" DataValueField="Product_Name">
</asp:DropDownList>
<ItemTemplate>
Product_Description:
<asp:TextBox ID="Product_DescriptionTextBox" runat="server" Text='<%# Bind("Product_Description") %>' />
<br />
<asp:Button ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert" />
<asp:Button ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</InsertItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Incident_TrackerConnectionString %>" InsertCommand="INSERT INTO [Incidents] ( [I_Product_Name], [I_Product_Description]) VALUES ( #Product_Name, #Product_Description)">
<InsertParameters>
<asp:ControlParameter Name="Product_Name" Type="String" />
<asp:Parameter Name="Product_Description" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:Incident_TrackerConnectionString %>" SelectCommand="select Product_Name from dbo.products"></asp:SqlDataSource>
</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td class="auto-style2"></td>
<td class="auto-style2"></td>
</tr>
<tr>
<td class="auto-style1"> </td>
<td class="auto-style1"></td>
<td class="auto-style1"></td>
</tr>
</table>
<br />
<br />
<br />
Thanks Kevin
You nee to specify the ControlID & PropertyName like this:-
<InsertParameters>
<asp:ControlParameter Name="Product_Name" ControlID="DropDownList1"
PropertyName="SelectedValue" />
</InsertParameters>
Edit:-
Okay, since you are using FormView, you need to specify it like this:-
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSource2" DataTextField="Product_Name"
DataValueField="Product_Name" SelectedValue=<%# Bind('Product_Name') %>>
</asp:DropDownList>
Then , bind the InsertParameters as:-
<InsertParameters>
<asp:Parameter Name="Product_Name" Type="String" />
<asp:Parameter Name="Product_Description" Type="String" />
</InsertParameters>

Cannot Find Control ID in ControlParameter

I am trying to insert values from a textbox but I get an error that it cannot find the controlid in the controlparameter. The TextBox is inside a formview, which is inside a listview. The SqlDataSource is outside the ListView.
My InsertButton_Click Method
protected void InsertButton_Click(object sender, EventArgs e)
{
var ctrl = (Control)sender;
var formview = (FormView)ctrl.NamingContainer;
formview.ChangeMode(FormViewMode.Insert);
SectionListView.DataSource = SectionDataSource;
SectionListView.DataBind();
}
The InsertItem Template
<InsertItemTemplate>
<tr style="">
<td>
<div style="font-size: .8em;">
<asp:FormView ID="SectionFormView" runat="server" DataKeyNames="SectionItemID" DataSourceID="SectionDataSource">
<ItemTemplate>
<asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" OnClick="InsertButton_Click" Font-Size="1.2em" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Clear" Font-Size="1.2em" />
<asp:Label ID="SectionItemLabel" runat="server" Text="SectionItem" Font-Bold="true" Font-Size="1.2em" />
<asp:TextBox ID="SectionItemTextBox" runat="server" />
<asp:Label ID="SectionItemSubLabel" runat="server" Text="SectionItem Label" Font-Bold="true" Font-Size="1.2em" />
<asp:TextBox ID="SectionItemLabelTextBox" runat="server"/>
</ItemTemplate>
</asp:FormView>
</div>
</td>
</tr>
</InsertItemTemplate>
My SqlDataSource
<asp:SqlDataSource ID="SectionDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ORHP_Dev03182014ConnectionString %>" SelectCommand="SELECT DISTINCT SectionItem,SectionItemLabel,SectionItemID FROM Core.SectionItem_Lkup"
InsertCommand="INSERT INTO Core.SectionItem_Lkup(SectionItem, SectionItemLabel) VALUES (#SectionItem, #SectionItemLabel)">
<InsertParameters>
<asp:ControlParameter ControlID="SectionItemTextBox" Name="SectionItem" PropertyName="Text" />
<asp:ControlParameter ControlID="SectionItemLabelTextBox" Name="SectionItemLabel" PropertyName="Text" />
</InsertParameters>
</asp:SqlDataSource>
When you want to use the child controls as control parameters, you need to use the qualified id as control id. Try changing the SQL data source as below
<asp:SqlDataSource ID="SectionDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ORHP_Dev03182014ConnectionString %>" SelectCommand="SELECT DISTINCT SectionItem,SectionItemLabel,SectionItemID FROM Core.SectionItem_Lkup"
InsertCommand="INSERT INTO Core.SectionItem_Lkup(SectionItem, SectionItemLabel) VALUES (#SectionItem, #SectionItemLabel)">
<InsertParameters>
<asp:ControlParameter ControlID="SectionFormView$SectionItemTextBox" Name="SectionItem" PropertyName="Text" />
<asp:ControlParameter ControlID="SectionFormView$SectionItemLabelTextBox" Name="SectionItemLabel" PropertyName="Text" />
</InsertParameters>
</asp:SqlDataSource>

Cannot get/use ControlParameter from GridView in a TemplateField SELECT statement

I have a simple GridView (with an ID of 'GridViewAttribs') which displays some values from a database.
Within my GridViewAttribs I wish to have a (nested?) ListView but for some reason I cannot use the asp:ControlParameter ControlID="GridViewAttribs" PropertyName as no results are returned in my (nested) ListView.
If I do NOT use the ControlParameter and hardcode my SELECT statement for the ListView, everything works as expected.
Here's my code:
<asp:SqlDataSource ID="SqlDataSourceAttribHeadings" runat="server"
ConnectionString="<%$ ConnectionStrings:customer_support_devConnectionString %>"
ProviderName="<%$ ConnectionStrings:customer_support_devConnectionString.ProviderName %>"
SelectCommand="SELECT equipment_attrib_heading_id, equipment_model_id, equipment_attrib_name FROM equipment_new_attrib_headings WHERE (equipment_model_id = #equipment_model_id) AND (equipment_attrib_heading_deleted = 0) ORDER BY equipment_attrib_name">
<SelectParameters>
<asp:SessionParameter DefaultValue="" Name="equipment_model_id"
SessionField="EquipmentModelID" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<asp:GridView ID="GridViewAttribs" runat="server" AutoGenerateColumns="False"
CellPadding="4" DataKeyNames="equipment_attrib_heading_id"
DataSourceID="SqlDataSourceAttribHeadings" ForeColor="#333333" GridLines="None"
style="margin-right: 0px">
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
<Columns>
<asp:BoundField DataField="equipment_attrib_heading_id"
HeaderText="equipment_attrib_heading_id" ReadOnly="True"
SortExpression="equipment_attrib_heading_id" />
<asp:BoundField DataField="equipment_model_id" HeaderText="equipment_model_id"
SortExpression="equipment_model_id" />
<asp:BoundField DataField="equipment_attrib_name"
HeaderText="equipment_attrib_name" SortExpression="equipment_attrib_name" />
<asp:TemplateField HeaderText="equipment_attrib_value_details" SortExpression="equipment_attrib_value_details">
<ItemTemplate>
<asp:SqlDataSource ID="SqlDataSourceAttribValues" runat="server"
ConnectionString="<%$ ConnectionStrings:customer_support_devConnectionString %>"
ProviderName="<%$ ConnectionStrings:customer_support_devConnectionString.ProviderName %>"
SelectCommand="SELECT [equipment_attrib_value_details] FROM [equipment_new_attrib_values] WHERE (equipment_attrib_heading_id = #head_id) AND (equipment_id = #equipment_id) AND (equipment_attrib_value_deleted = 0)">
<SelectParameters>
<asp:QueryStringParameter Name="equipment_id" QueryStringField="id"
Type="Int32" />
<asp:ControlParameter ControlID="GridViewAttribs"
Name="head_id" PropertyName="SelectedDataKey.Values[equipment_attrib_heading_id]" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<asp:ListView ID="ListViewAttribValues" runat="server"
DataSourceID="SqlDataSourceAttribValues">
<EmptyDataTemplate>
<table runat="server" style="">
<tr><td>No data was returned.</td></tr>
</table>
</EmptyDataTemplate>
<ItemTemplate>
<tr style="">
<td><asp:Label ID="equipment_attrib_value_detailsLabel" runat="server" Text='<%# Eval("equipment_attrib_value_details") %>' /></td>
</tr>
</ItemTemplate>
<LayoutTemplate>
<table ID="itemPlaceholderContainer" runat="server" border="0" style="">
<tr ID="itemPlaceholder" runat="server">
</tr>
</table>
</LayoutTemplate>
</asp:ListView>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
The GridView displays all columns fine except the "equipment_attrib_value_details" column where I get "No data was returned."
However, if I take out the asp:ControlParameter which calls upon #head_id and use this hardcoded SELECT statement then I see the correct (albeit hardcoded) values:
SelectCommand="SELECT [equipment_attrib_value_details] FROM [equipment_new_attrib_values] WHERE (equipment_attrib_heading_id = 3) AND (equipment_id = #equipment_id) AND (equipment_attrib_value_deleted = 0)">
Therefore, for some reason, it would appear that the GridViewAttribs value of "equipment_attrib_heading_id" is not being passed to / picked up by the nested asp:ControlParameter
On the off chance, I've also tried replacing:
PropertyName="SelectedDataKey.Values[equipment_attrib_heading_id]"
With:
PropertyName="SelectedValue"
But this didn't resolve the issue either, still not data was returned.
If it helps, I'm using Visual Studio 2010 with ASP.NET4 (vb).
What you could try is using a hidden field and use that control for the controlparameter
<asp:TemplateField HeaderText="equipment_attrib_value_details" SortExpression="equipment_attrib_value_details">
<ItemTemplate>
<asp:HiddenField runat="server" ID="heading_id" Value='<%# Eval("equipment_attrib_heading_id") %>' />
<asp:SqlDataSource ID="SqlDataSourceAttribValues" runat="server"
ConnectionString="<%$ ConnectionStrings:customer_support_devConnectionString %>"
ProviderName="<%$ ConnectionStrings:customer_support_devConnectionString.ProviderName %>"
SelectCommand="SELECT [equipment_attrib_value_details] FROM [equipment_new_attrib_values] WHERE (equipment_attrib_heading_id = #head_id) AND (equipment_id = #equipment_id) AND (equipment_attrib_value_deleted = 0)">
<SelectParameters>
<asp:QueryStringParameter Name="equipment_id" QueryStringField="id" Type="Int32" />
<asp:ControlParameter ControlID="heading_id" Name="head_id" PropertyName="Value" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<asp:ListView ID="ListViewAttribValues" runat="server"
DataSourceID="SqlDataSourceAttribValues">
<EmptyDataTemplate>
<table id="Table2" runat="server" style="">
<tr><td>No data was returned.</td></tr>
</table>
</EmptyDataTemplate>
<ItemTemplate>
<tr style="">
<td><asp:Label ID="equipment_attrib_value_detailsLabel" runat="server" Text='<%# Eval("equipment_attrib_value_details") %>' /></td>
</tr>
</ItemTemplate>
<LayoutTemplate>
<table ID="itemPlaceholderContainer" runat="server" border="0" style="">
<tr ID="itemPlaceholder" runat="server">
</tr>
</table>
</LayoutTemplate>
</asp:ListView>
</ItemTemplate>
</asp:TemplateField>
This only works (it seems) if the HiddenField is inside the same ItemTemplate. If the DataSource is somewhere outside the TemplateField, in cases where you want to data-populate a control that is say on another column or field of the GridView, then the HiddenField will not work, as it's technically hidden.
The way to overcome this is in code-behind. Here is how I do it...
I have a TemplateField that is referring to #StudentID, which is actually a HiddenField in another TemplateField.
<asp:TemplateField HeaderText="Currently<br/>Tracking<br/>(past weeks)">
<ItemTemplate>
<asp:CheckBoxList ID="listWeeksTracking" runat="server" DataSourceID="sdsTETpastWeeks" DataTextField="WeekNo" DataValueField="WeekNo"
OnDataBound="listWeeksTracking_DataBound" OnDataBinding="listWeeksTracking_DataBinding"></asp:CheckBoxList>
<br />
<asp:SqlDataSource ID="sdsTETpastWeeks" runat="server" ConnectionString="<%$ ConnectionStrings:ATCNTV1ConnectionString %>"
SelectCommand="SELECT tb.WeekNo, ISNULL((SELECT TOP 1 ts.ETRTWtracking FROM tblTETMeetingStudent AS ts INNER JOIN tblTETMeeting AS tm ON tm.TETmeetingID = ts.TETmeetingID AND tm.WeekNo = tb.WeekNo WHERE ts.StudentID = #StudentID),0) AS Tracking FROM tblTETInstructionalTrainingBlocks AS tb WHERE tb.WeekNo <= #WeekNo AND tb.Active = 1 AND tb.YearNum = YEAR(#TETdate) ORDER BY tb.WeekNo">
<SelectParameters>
<asp:Parameter Name="StudentID" Type="string" />
<asp:ControlParameter ControlID="ddlWeekNo" Name="WeekNo" PropertyName="SelectedValue" Type="int16" />
<asp:ControlParameter ControlID="lblTETdate" Name="TETdate" Type="DateTime" />
</SelectParameters>
</asp:SqlDataSource>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
<HeaderStyle Wrap="False" />
</asp:TemplateField>
So I define the #StudentID parameter as simple a parameter, and not a ControlParameter, is it won't be able to pick up the hiddenfield elsewhere in my GridView.
In code-behind (C#), I trap the Selecting event via the DataBinding.
And in there I specifically look for the row in relation to the control I've just populated (or about to), and then I look for the HiddenField.
protected void listWeeksTracking_DataBinding(object sender, EventArgs e)
{
//set the parameter for the StudentID here as using hiddenfields does not work directly in asp.net, as they are hidden!
CheckBoxList cbl1 = (CheckBoxList)sender;
GridViewRow gvRow = (GridViewRow)cbl1.NamingContainer;
if (gvRow != null)
{
SqlDataSource sdsTETpastWeeks = (SqlDataSource)gvRow.FindControl("sdsTETpastWeeks");
HiddenField hfStudentID = (HiddenField)gvRow.FindControl("hfStudentID");
if (hfStudentID != null) sdsTETpastWeeks.SelectParameters["StudentID"].DefaultValue = hfStudentID.Value.ToString();
}
}
Voila!

ASP.NET error, must declare the scalar variable "#ServerName" after second dropdownlist is select

There are 3 dropdownlists which are parent-child, after the 3rd dropdownlist is selected, the DetailsView will display result from all 3 dropdownlist selected. first is ServerName, second is Instance, then third is DatabaseName. After select first dropdownlist of servername, then new list of instance value appear on second dropdownlist. When I select anything on second dropdownlist. There a error message that say, "Must declare the scalar variable "#ServerName"". I don't understand what it mean and please help. Here a dropdownlist codes,
<ajaxToolkit:ComboBox ID="ComboBox1" runat="server" AutoCompleteMode="SuggestAppend" AutoPostBack="True" DataSourceID="SqlDataSource4" DataTextField="ServerName" DataValueField="ServerName" DropDownStyle="Simple" MaxLength="0" style="display: inline;">
</ajaxToolkit:ComboBox>
<asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:Database_Shared_NotebookConnectionString %>" SelectCommand="SELECT [ServerName] FROM [tblServer]">
</asp:SqlDataSource>
<br />
<br />
<asp:Label ID="Label11" runat="server" Text="Select Instance:"></asp:Label>
<br />
<asp:DropDownList ID="DropDownInstance" runat="server" AutoPostBack="True" DataSourceID="Instance" DataTextField="Instance" DataValueField="Instance">
</asp:DropDownList>
<asp:SqlDataSource ID="Instance" runat="server" ConnectionString="<%$ ConnectionStrings:Database_Shared_NotebookConnectionString %>" SelectCommand="SELECT [Instance] FROM [tblDatabase] WHERE [ServerName] = #ServerName">
<SelectParameters>
<asp:ControlParameter ControlID="ComboBox1" Name="ServerName" PropertyName="SelectedValue" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<br />
<asp:Label ID="Label10" runat="server" Text="Select Database:"></asp:Label>
<br />
<asp:DropDownList ID="DropDownDatabase" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource3" DataTextField="DatabaseName" DataValueField="DatabaseName">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:Database_Shared_NotebookConnectionString %>" SelectCommand="SELECT [DatabaseName] FROM [tblDatabase] WHERE [ServerName] = #ServerName AND [Instance] = #Instance">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownInstance" Name="Instance" PropertyName="SelectedValue" />
</SelectParameters>
</asp:SqlDataSource>
Then I pass those dropdownlist function to DetailsView that come with SQLDataSource2,
on SelectCommand in SQLDataSource2, I wrote
SelectCommand="SELECT * FROM [tblDatabase] WHERE (([DatabaseName] = #DatabaseName) AND ([Instance] = #Instance) AND ([ServerName] = #ServerName))"
Then after that I add SelectParameter codes,
<SelectParameters>
<asp:ControlParameter ControlID="DropDownDatabase" Name="DatabaseName" PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="DropDownInstance" Name="Instance" PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="ComboBox1" Name="ServerName" PropertyName="SelectedValue" Type="String" />
</SelectParameters>
In SqlDataSource3, your query takes two parameters: #ServerName and #Instance. But in the select parameters, you only define #Instance. Yes, you defined #ServerName in the previous data source, but not in this one.
I fixed from what Jay metioned recently and there also another issue that I fix it on instance and database dropdownlist codes, where what I fix and it work fine.
<asp:Label ID="Label11" runat="server" Text="Select Instance:"></asp:Label>
<br />
<asp:DropDownList ID="DropDownInstance" runat="server" AutoPostBack="True" DataSourceID="Instance" DataTextField="Instance" DataValueField="Instance">
</asp:DropDownList>
<asp:SqlDataSource ID="Instance" runat="server" ConnectionString="<%$ ConnectionStrings:Database_Shared_NotebookConnectionString %>" SelectCommand="SELECT [Instance] FROM [tblDatabase] WHERE [ServerName] = #ServerName">
<SelectParameters>
<asp:ControlParameter ControlID="ComboBox1" Name="ServerName" PropertyName="SelectedValue" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<br />
<asp:Label ID="Label10" runat="server" Text="Select Database:"></asp:Label>
<br />
<asp:DropDownList ID="DropDownDatabase" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource3" DataTextField="DatabaseName" DataValueField="DatabaseName">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:Database_Shared_NotebookConnectionString %>" SelectCommand="SELECT [DatabaseName] FROM [tblDatabase] WHERE [ServerName] = #ServerName AND [Instance] = #Instance">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownInstance" Name="Instance" PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="ComboBox1" Name="ServerName" PropertyName="SelectedValue" />
</SelectParameters>
</asp:SqlDataSource>

Issue with MS AJAX reorder list. ASP.NET

am using a reorder list in my UI. My reorder list is and SQLDataSource are shown below. I get an error message
"Reorder failed, see details below.\r\n\r\nFailed to reorder."
Seems trivial but not able to find the issue. Can you please help me with this issue ?
SOURCE CODE
' />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString='<%$ ConnectionStrings:ConnectionString %>'
SelectCommand="SELECT * FROM TBL_BATCH_STAGE WHERE RQUST_KEY=#RequestId ORDER BY [ORDER_NO] ASC"
UpdateCommand="UPDATE [TBL_BATCH_STAGE] SET [ORDER]=#Order WHERE [BATCH_STG_KEY] = #original_ID"
OldValuesParameterFormatString="original_{0}">
<SelectParameters>
<asp:SessionParameter Name="RequestId" SessionField="RequestId" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="Order" Type="Int32" />
<asp:Parameter Name="original_ID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
Resolved this issue.My SQL parameters did not match my ReorderList variable names.
<asp:SqlDataSource ID="SqlDataSource1" OldValuesParameterFormatString="original_{0}" runat="server" ConnectionString='<%$ ConnectionStrings:ConnectionString %>'
SelectCommand="SELECT * FROM TBL_BATCH_STAGE WHERE RQUST_KEY=#RequestId ORDER BY [ORDER_NO] ASC"
UpdateCommand="UPDATE [TBL_BATCH_STAGE] SET [ORDER_NO]=#ORDER_NO WHERE [BATCH_STG_KEY] = #original_BATCH_STG_KEY" >
<SelectParameters>
<asp:SessionParameter Name="RequestId" SessionField="RequestId" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="ORDER_NO" Type="Int32" />
<asp:Parameter Name="original_BATCH_STG_KEY" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
<asp:ReorderList ID="ReorderList1" runat="server" AllowReorder="true" DataKeyField="BATCH_STG_KEY" DataSourceID="SqlDataSource1" SortOrderField="ORDER_NO">
<ItemTemplate>
<table style="border:solid 1px #cccccc;">
<tr>
<td style="vertical-align:top;list-style:none;font-size:13px;padding:0 0 0 0;">
<asp:Label ID="ItemLabel" runat="server" Text='<%# Eval("BATCH_STG_TEXT")%>' />
</td>
</tr>
</table>
</ItemTemplate>
</asp:ReorderList>

Resources