I have this ImageButton and Label in my GridView
Grid Definition is as follows
<asp:TemplateField HeaderText="Send kwm">
<ItemTemplate>
<center>
<asp:ImageButton ID="Sendkwm" runat="server" ImageUrl="/Images/check.gif"
OnClick="Sendkwm" />
</center>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<center>
<asp:Label ID="kwm" runat="server" Text='<%# Eval("kwm").ToString() %>'></asp:Label>
</center>
</ItemTemplate>
</asp:TemplateField>
My problem is I need to use the querystring value of kwm to update which column of data I'm going to display.
I searched on the web but it seems that it is necessary to use the GridView the SqlDataSource, is there any alternative to do this alternative method ?
My code-behind below.
Any help would be appreciated, thank you in advance.
protected void Sendkwm(object sender, EventArgs e)
{
using (OdbcConnection conn =
new OdbcConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString))
{
sql = " UPDATE doTable " +
" SET myDate = CURRENT_TIMESTAMP () " +
" WHERE " +
" kwm = //here the querystring value of kwm// ; ";
using (OdbcCommand command =
new OdbcCommand(sql,conn))
{
try
{
command.Connection.Open();
command.ExecuteNonQuery();
}
catch (Exception ex)
{
throw ex;
}
finally
{
command.Connection.Close();
}
}
}
}