W
Wolffang
I have a column in a datagrid which is OrderID. I am trying to pass its
values when rows are clicked to code in my codebehind that will update my
database via the database... i have tried to convert the value to a label in
my aspx page, so i can read its value... maybe this is wrong... any one have
any other ideas???
SQL profiler states :
exec dbo.[USP_Admin_Update_UserProcessLock] @OrderID = N'', @AdminUserName =
N'Admin', @AdminProcess = 1
so OrderID is still not being passed here....
MY CODE.....
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
<code behind>
-------------------------------------------------------------------------------------
Dim dg As DataGridItem
Dim ck As CheckBox
Dim OrdID As Label
Me.SqlConnection1.Open()
For Each dg In dgOrders.Items
ck = dg.FindControl("chkSelect")
OrdID = dg.FindControl("Label1")
If ck.Checked = True Then
Me.SqlCommand1.Parameters("@OrderID").Value = OrdID.Text
Me.SqlCommand1.Parameters("@AdminUserName").Value = lblUserName.Text
Me.SqlCommand1.Parameters("@AdminProcess").Value = 1
Me.SqlCommand1.ExecuteNonQuery()
End If
Next
Me.SqlConnection1.Close()
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
<ASPX>
-------------------------------------------------------------------------------------
<HeaderTemplate>
<asp:CheckBox id="chkAll"
onclick="javascript:SelectAllCheckboxes(this);" runat="server"
AutoPostBack="false"
ToolTip="Select/Deselect All" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox id="chkSelect"
onclick="javascript:HighlightRow(this);" runat="server"
OnCheckedChanged="dgOrders_CheckedChanged"
AutoPostBack="false" Enabled="True" />
<asp:Label id="Label1" runat="server">
<%# Container.DataItem("OrderID") %>
</asp:Label>
</ItemTemplate>
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
<SQL stored Procedure...>
-------------------------------------------------------------------------------------
CREATE PROCEDURE USP_Admin_Update_UserProcessLock
@OrderID NVARCHAR(15),
@AdminUserName NVARCHAR(15),
@AdminProcess BIT
AS
UPDATE
tblOrderDetails
SET
AdminUserName = @AdminUserName,
AdminProcess = @AdminProcess
WHERE
OrderID = @OrderID
GO
-------------------------------------------------------------------------------------
values when rows are clicked to code in my codebehind that will update my
database via the database... i have tried to convert the value to a label in
my aspx page, so i can read its value... maybe this is wrong... any one have
any other ideas???
SQL profiler states :
exec dbo.[USP_Admin_Update_UserProcessLock] @OrderID = N'', @AdminUserName =
N'Admin', @AdminProcess = 1
so OrderID is still not being passed here....
MY CODE.....
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
<code behind>
-------------------------------------------------------------------------------------
Dim dg As DataGridItem
Dim ck As CheckBox
Dim OrdID As Label
Me.SqlConnection1.Open()
For Each dg In dgOrders.Items
ck = dg.FindControl("chkSelect")
OrdID = dg.FindControl("Label1")
If ck.Checked = True Then
Me.SqlCommand1.Parameters("@OrderID").Value = OrdID.Text
Me.SqlCommand1.Parameters("@AdminUserName").Value = lblUserName.Text
Me.SqlCommand1.Parameters("@AdminProcess").Value = 1
Me.SqlCommand1.ExecuteNonQuery()
End If
Next
Me.SqlConnection1.Close()
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
<ASPX>
-------------------------------------------------------------------------------------
<HeaderTemplate>
<asp:CheckBox id="chkAll"
onclick="javascript:SelectAllCheckboxes(this);" runat="server"
AutoPostBack="false"
ToolTip="Select/Deselect All" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox id="chkSelect"
onclick="javascript:HighlightRow(this);" runat="server"
OnCheckedChanged="dgOrders_CheckedChanged"
AutoPostBack="false" Enabled="True" />
<asp:Label id="Label1" runat="server">
<%# Container.DataItem("OrderID") %>
</asp:Label>
</ItemTemplate>
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
<SQL stored Procedure...>
-------------------------------------------------------------------------------------
CREATE PROCEDURE USP_Admin_Update_UserProcessLock
@OrderID NVARCHAR(15),
@AdminUserName NVARCHAR(15),
@AdminProcess BIT
AS
UPDATE
tblOrderDetails
SET
AdminUserName = @AdminUserName,
AdminProcess = @AdminProcess
WHERE
OrderID = @OrderID
GO
-------------------------------------------------------------------------------------