ASPX Datagridview. How to use a button to change a cell value? Visual Studio 2008.
Hello all. I have a question regarding using a button I have created on each row of a datagridview. It will be simple for you guys I am very sure ;-)
I have created a custom button to appear like so.
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="RLID" HeaderText="RLID" ReadOnly="True"
SortExpression="RLID" />
<asp:BoundField DataField="RLPart" HeaderText="RLPart"
SortExpression="RLPart" />
<asp:BoundField DataField="RLQty" HeaderText="RLQty" SortExpression="RLQty" />
<asp:BoundField DataField="RLStatus" HeaderText="RLStatus"
SortExpression="RLStatus" />
<asp:ButtonField HeaderText="Reset Tray"
ButtonType="button" CommandName="Reset Tray" text = "Reset Tray" />
</Columns>
What I wish to do is "Onclick" I wish the values in field RLPART to be changed to "*EMPTY* " and field RLQTY to be changed to "0".
SQL Connector is as follows. Probably unnecessary but I thought I would add it to give all info posssible.
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:RightFirstTimeConnectionString2 %>"
DeleteCommand="DELETE FROM [factRepairLocation] WHERE [RLID] = @original_RLID AND (([RLPart] = @original_RLPart) OR ([RLPart] IS NULL AND @original_RLPart IS NULL)) AND (([RLQty] = @original_RLQty) OR ([RLQty] IS NULL AND @original_RLQty IS NULL)) AND (([RLStatus] = @original_RLStatus) OR ([RLStatus] IS NULL AND @original_RLStatus IS NULL))"
InsertCommand="INSERT INTO [factRepairLocation] ([RLID], [RLPart], [RLQty], [RLStatus]) VALUES (@RLID, @RLPart, @RLQty, @RLStatus)"
OldValuesParameterFormatString="original_{0}"
SelectCommand="SELECT [RLID], [RLPart], [RLQty], [RLStatus] FROM [factRepairLocation]"
UpdateCommand="UPDATE [factRepairLocation] SET [RLPart] = @RLPart, [RLQty] = @RLQty, [RLStatus] = @RLStatus WHERE [RLID] = @original_RLID AND (([RLPart] = @original_RLPart) OR ([RLPart] IS NULL AND @original_RLPart IS NULL)) AND (([RLQty] = @original_RLQty) OR ([RLQty] IS NULL AND @original_RLQty IS NULL)) AND (([RLStatus] = @original_RLStatus) OR ([RLStatus] IS NULL AND @original_RLStatus IS NULL))">
<DeleteParameters>
<asp:Parameter Name="original_RLID" Type="String" />
<asp:Parameter Name="original_RLPart" Type="String" />
<asp:Parameter Name="original_RLQty" Type="Int32" />
<asp:Parameter Name="original_RLStatus" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="RLPart" Type="String" />
<asp:Parameter Name="RLQty" Type="Int32" />
<asp:Parameter Name="RLStatus" Type="String" />
<asp:Parameter Name="original_RLID" Type="String" />
<asp:Parameter Name="original_RLPart" Type="String" />
<asp:Parameter Name="original_RLQty" Type="Int32" />
<asp:Parameter Name="original_RLStatus" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="RLID" Type="String" />
<asp:Parameter Name="RLPart" Type="String" />
<asp:Parameter Name="RLQty" Type="Int32" />
<asp:Parameter Name="RLStatus" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
I won't bore you guys with what I have already tried as obviously it failed. I hope you guys (well, I am actually sure) that you can help me.
All the best
Chris