J
John
i have a datagrid with a delete button which for some reason quit working,
i'm thinking its a problem with the database but here is the code:
SqlCommand cmdDeletePIN = null;
try
{
myConnection = new SqlConnection(connectionString);
myConnection.Open();
cmdDeletePIN = new SqlCommand("usp_AdminDeactivatePIN", myConnection);
cmdDeletePIN.CommandType = CommandType.StoredProcedure;
SqlParameter prmClientID = cmdDeletePIN.Parameters.Add("@clientID",
SqlDbType.Int);
prmClientID.Value = Request.Params["clientID"];
SqlParameter prmPIN= cmdDeletePIN.Parameters.Add("@PIN", SqlDbType.Int);
prmPIN.Value = dgPINList.DataKeys[e.Item.ItemIndex].ToString();
cmdDeletePIN.ExecuteNonQuery();
}
catch (Exception ex)
{
Trace.Write("Admin - EditClient.aspx", "dgPINList_DeleteCommand() - ",
ex);
}
finally
{
cmdDeletePIN.Dispose();
myConnection.Close();
}
dgPINList.EditItemIndex = -1;
bindGrid();
}
sorry if its hard to read. i know the method gets called by my image button
because i put some trace.write's in there to follow execution. no exceptions
are thrown because that trace.write never gets executed and i get no other
errors. it just doesnt do anything except post back. also I have a link
around the image button which causes a custom confirm box to popup, which
works fine in mozilla, but doesnt show in IE 6.0 i know the code works
because i tested it in its own page before adding it to the project.
<asp:templatecolumn>
<itemstyle horizontalalign="Center"></itemstyle>
<itemtemplate>
<a href="javascript:confirmDeactivatePIN()">
<asp:ImageButton runat="server" id="ibtnDelete"
CommandName="Delete" ImageUrl="images/icon_delete.gif"
AlternateText="Deactivate this PIN"></asp:ImageButton>
</a>
</itemtemplate>
</asp:templatecolumn>
there's how a call the box. i also need to return a value from the box to
determine if the user wans to deactivate the service or the entire pin based
on which button they push in the custom box and get it to the codebehind for
an if statement i have yet to write.
Thanks in advance
John
i'm thinking its a problem with the database but here is the code:
SqlCommand cmdDeletePIN = null;
try
{
myConnection = new SqlConnection(connectionString);
myConnection.Open();
cmdDeletePIN = new SqlCommand("usp_AdminDeactivatePIN", myConnection);
cmdDeletePIN.CommandType = CommandType.StoredProcedure;
SqlParameter prmClientID = cmdDeletePIN.Parameters.Add("@clientID",
SqlDbType.Int);
prmClientID.Value = Request.Params["clientID"];
SqlParameter prmPIN= cmdDeletePIN.Parameters.Add("@PIN", SqlDbType.Int);
prmPIN.Value = dgPINList.DataKeys[e.Item.ItemIndex].ToString();
cmdDeletePIN.ExecuteNonQuery();
}
catch (Exception ex)
{
Trace.Write("Admin - EditClient.aspx", "dgPINList_DeleteCommand() - ",
ex);
}
finally
{
cmdDeletePIN.Dispose();
myConnection.Close();
}
dgPINList.EditItemIndex = -1;
bindGrid();
}
sorry if its hard to read. i know the method gets called by my image button
because i put some trace.write's in there to follow execution. no exceptions
are thrown because that trace.write never gets executed and i get no other
errors. it just doesnt do anything except post back. also I have a link
around the image button which causes a custom confirm box to popup, which
works fine in mozilla, but doesnt show in IE 6.0 i know the code works
because i tested it in its own page before adding it to the project.
<asp:templatecolumn>
<itemstyle horizontalalign="Center"></itemstyle>
<itemtemplate>
<a href="javascript:confirmDeactivatePIN()">
<asp:ImageButton runat="server" id="ibtnDelete"
CommandName="Delete" ImageUrl="images/icon_delete.gif"
AlternateText="Deactivate this PIN"></asp:ImageButton>
</a>
</itemtemplate>
</asp:templatecolumn>
there's how a call the box. i also need to return a value from the box to
determine if the user wans to deactivate the service or the entire pin based
on which button they push in the custom box and get it to the codebehind for
an if statement i have yet to write.
Thanks in advance
John