Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > delete button problems in datagrid

Reply
Thread Tools

delete button problems in datagrid

 
 
John
Guest
Posts: n/a
 
      06-07-2005
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
 
Reply With Quote
 
 
 
 
Elton Wang
Guest
Posts: n/a
 
      06-07-2005
Hi John,


Generally speaking, your ImageButton in datagrid can trigger
datagrid_ItemCommand event. In the event you can have

if (e.CommandName.Equals("Delete"))
{
// process delete function
}

BTW, in the event, you can use e.Item.Cells[col_index].Text to get
BoundColumn's data, or use ((TextBox)e.Item.FindControl("controlID")).Text
to get TemplateColumn + TextBox's data.

HTH

Elton W

"John" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
 
 
 
John
Guest
Posts: n/a
 
      06-07-2005

it does trigger the datagrid_DeleteCommand event and that code does fire
because i can read my trace.writes which i omitted in my post to make it
easier to read. i'm just wondering if there is a problem in my code which is
why things arent deleteing. also i need to know why my popup shows in
mozilla but not in IE, and how to get the values it returns into the code
behind. thanks for your help. if you need to see any code just shoot me an
email at http://www.velocityreviews.com/forums/(E-Mail Removed) and i'll try to send whatever you need.

"Elton Wang" wrote:

> Hi John,
>
>
> Generally speaking, your ImageButton in datagrid can trigger
> datagrid_ItemCommand event. In the event you can have
>
> if (e.CommandName.Equals("Delete"))
> {
> // process delete function
> }
>
> BTW, in the event, you can use e.Item.Cells[col_index].Text to get
> BoundColumn's data, or use ((TextBox)e.Item.FindControl("controlID")).Text
> to get TemplateColumn + TextBox's data.
>
> HTH
>
> Elton W
>
> "John" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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

>
>
>

 
Reply With Quote
 
Elton Wang
Guest
Posts: n/a
 
      06-07-2005
Could you post html code of the datagrid?

"John" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> it does trigger the datagrid_DeleteCommand event and that code does fire
> because i can read my trace.writes which i omitted in my post to make it
> easier to read. i'm just wondering if there is a problem in my code which

is
> why things arent deleteing. also i need to know why my popup shows in
> mozilla but not in IE, and how to get the values it returns into the code
> behind. thanks for your help. if you need to see any code just shoot me

an
> email at (E-Mail Removed) and i'll try to send whatever you need.
>
> "Elton Wang" wrote:
>
> > Hi John,
> >
> >
> > Generally speaking, your ImageButton in datagrid can trigger
> > datagrid_ItemCommand event. In the event you can have
> >
> > if (e.CommandName.Equals("Delete"))
> > {
> > // process delete function
> > }
> >
> > BTW, in the event, you can use e.Item.Cells[col_index].Text to get
> > BoundColumn's data, or use

((TextBox)e.Item.FindControl("controlID")).Text
> > to get TemplateColumn + TextBox's data.
> >
> > HTH
> >
> > Elton W
> >
> > "John" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > 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

> >
> >
> >



 
Reply With Quote
 
John
Guest
Posts: n/a
 
      06-07-2005
<td><asp:datagrid id="dgPINList" runat="server" backcolor="White"
width="550px" datakeyfield="PIN"
allowsorting="True" autogeneratecolumns="False"
bordercolor="#3D653D">
<alternatingitemstyle
backcolor="#DDDDDD"></alternatingitemstyle>
<headerstyle cssclass="tableHeader"></headerstyle>
<columns>
<asp:editcommandcolumn buttontype="LinkButton"
updatetext="<img src='images/icon_save.gif' width='16' height='16' alt='Save
Changes' border='0'>"
canceltext="<img src='images/icon_cancel.gif' width='16'
height='16' alt='Cancel Changes' border='0'>"
edittext="<img src='images/icon_edit.gif' width='16'
height='16' alt='Edit This Record' border='0'>"></asp:editcommandcolumn>
<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 is more but i'm fairly certain that the rest of the columns dont
matter as they are just data. and my boss recently told me that the delete
command has never worked so if you dont mind could you or someone please take
a look at the c# code i posted dealing with the sql commands and let me know
why the clientID and PIN number arent in sinc

thanks guys
 
Reply With Quote
 
John
Guest
Posts: n/a
 
      06-07-2005
also here is my custom box...sorry but the code is rather long and possilbly
hard to read once i put in on here

function confirmDeactivatePIN(){
var confirmwin;
if (navigator.appName=="Microsoft Internet Explorer" ||
navigator.appName=="MSIE 6.0"){
confirmwin = window.showModalDialog("popup_ConfirmContent.aspx" ,
"confirmwin",
"dialogHeight:150px;dialogWidth:200px;dialogLeft:3 00;dialogTop:300;resizable:no; scroll:no");
}
if (navigator.appName=="Netscape"){
var winHeight = 150;
var winWidth = 200;
var xPos = (screen.availWidth/2)-(winWidth/2);
var yPos = (screen.availHeight/2)-(winHeight/2);
confirmwin = window.open("", "confirmwin",
"height="+winHeight+",width="+winWidth+",screenX=" +xPos+",screenY="+yPos+",left="+xPos+",top="+yPos) ;
var content = "<html>"+
"<head>"+
"<title>Confirm</title>"+
"</head>"+
"<body bgcolor='#CCCCCC' onblur='window.focus();'>"+
"<center>"+
"<form id=form1 name=form1>"+
"<table bgcolor='green' border='0' cellpadding='0' cellspacing='0'>"+
"<tr>"+
"<td>"+
"<table width='+(winWidth+20)+' height='+(winHeight-100)+'
border='0'>"+
"<tr>"+
"<td colspan='3' height='+(winHeight-100)+' valign='top'
align='left' bgcolor='white'>"+
"Press Service to deactivate the PIN's service, PIN to
deactivate their login and service"+
"</td>"+
"</tr>"+
"<tr>"+
"<td height='50' width='33%' valign='middle' align='center'
bgcolor='white'>"+
"<input type='button' width='50' style='width:50'
value='Service' onclick='window.returnValue=7;window.close();'>"+
"</td>"+
"<td height='50' width='34%' valign='middle' align='center'
bgcolor='white'>"+
"<input type='button' width='50' style='width:50' value='PIN'
onclick='window.returnValue=6;window.close();'>"+
"</td>"+
"<td height='50' width='33%' valign='middle' align='center'
bgcolor='white'>"+
"<input type='button' width='50' style='width:50'
value='Cancel' onclick='window.close();'>"+
"</td>"+
"</tr>"+
"</table>"+
"</td>"+
"</tr>"+
"</table>"+
"</center>"+
"</form>"+
"</body>"+
"</html>";
confirmwin.document.write(content);
confirmwin.document.close();
}//end if navigator.appname=="mozilla"
}//end function
 
Reply With Quote
 
Elton Wang
Guest
Posts: n/a
 
      06-07-2005
But I cannot see any data column in datagrid.


"John" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> <td><asp:datagrid id="dgPINList" runat="server" backcolor="White"
> width="550px" datakeyfield="PIN"
> allowsorting="True" autogeneratecolumns="False"
> bordercolor="#3D653D">
> <alternatingitemstyle
> backcolor="#DDDDDD"></alternatingitemstyle>
> <headerstyle cssclass="tableHeader"></headerstyle>
> <columns>
> <asp:editcommandcolumn buttontype="LinkButton"
> updatetext="<img src='images/icon_save.gif' width='16' height='16'

alt='Save
> Changes' border='0'>"
> canceltext="<img src='images/icon_cancel.gif' width='16'
> height='16' alt='Cancel Changes' border='0'>"
> edittext="<img src='images/icon_edit.gif' width='16'
> height='16' alt='Edit This Record' border='0'>"></asp:editcommandcolumn>
> <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 is more but i'm fairly certain that the rest of the columns dont
> matter as they are just data. and my boss recently told me that the

delete
> command has never worked so if you dont mind could you or someone please

take
> a look at the c# code i posted dealing with the sql commands and let me

know
> why the clientID and PIN number arent in sinc
>
> thanks guys



 
Reply With Quote
 
Elton Wang
Guest
Posts: n/a
 
      06-07-2005
Since you mentioned DeleteCommand event works, I suppose something wrong in
your deleting logic, it's data related. Hence it's better to have data
coulmns.


"John" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> <td><asp:datagrid id="dgPINList" runat="server" backcolor="White"
> width="550px" datakeyfield="PIN"
> allowsorting="True" autogeneratecolumns="False"
> bordercolor="#3D653D">
> <alternatingitemstyle
> backcolor="#DDDDDD"></alternatingitemstyle>
> <headerstyle cssclass="tableHeader"></headerstyle>
> <columns>
> <asp:editcommandcolumn buttontype="LinkButton"
> updatetext="<img src='images/icon_save.gif' width='16' height='16'

alt='Save
> Changes' border='0'>"
> canceltext="<img src='images/icon_cancel.gif' width='16'
> height='16' alt='Cancel Changes' border='0'>"
> edittext="<img src='images/icon_edit.gif' width='16'
> height='16' alt='Edit This Record' border='0'>"></asp:editcommandcolumn>
> <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 is more but i'm fairly certain that the rest of the columns dont
> matter as they are just data. and my boss recently told me that the

delete
> command has never worked so if you dont mind could you or someone please

take
> a look at the c# code i posted dealing with the sql commands and let me

know
> why the clientID and PIN number arent in sinc
>
> thanks guys



 
Reply With Quote
 
John
Guest
Posts: n/a
 
      06-07-2005
here is the entire datagrid control, i belive i know what is wrong but i'm
not exactly sure how to fix it. the client ID and PIN numer need to match or
the db wont find the correct listing and will therefore not delete anything,
so i need to work on the delete logic and the stored procedure's. if you
have any ideas on how to make the delete logic look for the correct client
id. i belive i can fix that part now that i think about it somemore. but i
cant seem to get my javascript to fire in IE 6.0, but it does fire in mozilla
but the page wont post back. i NEED this script to fire send a value
(determinied by what button the user pushes) back to the server to determine
which stored procedure to run. Note: the if statement about which procedure
to run has not been written yet beacuse i cant get the first few steps to
work right. so for now i'd be happy getting a value back for now and worry
about using it later.

<td><asp:datagrid id="dgPINList" runat="server" backcolor="White"
width="550px" datakeyfield="PIN"
allowsorting="True" autogeneratecolumns="False"
bordercolor="#3D653D">
<alternatingitemstyle
backcolor="#DDDDDD"></alternatingitemstyle>
<headerstyle cssclass="tableHeader"></headerstyle>
<columns>
<asp:editcommandcolumn buttontype="LinkButton"
updatetext="<img src='images/icon_save.gif' width='16' height='16' alt='Save
Changes' border='0'>"
canceltext="<img src='images/icon_cancel.gif' width='16'
height='16' alt='Cancel Changes' border='0'>"
edittext="<img src='images/icon_edit.gif' width='16'
height='16' alt='Edit This Record' border='0'>"></asp:editcommandcolumn>
<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>
<asp:templatecolumn>
<itemstyle horizontalalign="Center"></itemstyle>
<itemtemplate>
<asp:label runat="server" id="Label1">
<a href='javascriptopupClientWindow(<%#
DataBinder.Eval(Container, "DataItem.PIN") %>);'>
<img src="images/icon_login.gif" border="0" alt="Login
Under this PIN"></a></asp:label>
</itemtemplate>
</asp:templatecolumn>
<asp:templatecolumn>
<itemstyle horizontalalign="Center"></itemstyle>
<itemtemplate>
<a href='SwitchBoard.aspx?mode=archive&clientID=<%#
Request.Params["clientID"] %>&PIN=<%# DataBinder.Eval(Container,
"DataItem.PIN") %>'>
<img src="images/icon_archive.gif" width="16"
height="16" border="0" alt="Archive this PIN"></a>
</itemtemplate>
</asp:templatecolumn>
<asp:templatecolumn sortexpression="Pin" headertext="PIN">
<itemtemplate>
<a href='EditClient2.aspx?PIN=<%#
DataBinder.Eval(Container, "DataItem.PIN") %>&clientID=<%#
DataBinder.Eval(Container, "DataItem.ClientId") %>'>
<%# DataBinder.Eval(Container, "DataItem.PIN") %>
</a>
</itemtemplate>
</asp:templatecolumn>
<asp:templatecolumn sortexpression="Description"
headertext="Description">
<itemtemplate>
<asp:label runat="server" text='<%#
DataBinder.Eval(Container, "DataItem.Description") %>' id="Label3">
</asp:label>
</itemtemplate>
<edititemtemplate>
<asp:textbox runat="server" text='<%#
DataBinder.Eval(Container, "DataItem.Description") %>' width="180px"
id="txtPINDescription">
</asp:textbox>
</edititemtemplate>
</asp:templatecolumn>
<asp:templatecolumn sortexpression="ANI" headertext="ANI">
<itemtemplate>
<asp:label runat="server" text='<%#
DataBinder.Eval(Container, "DataItem.ANI") %>' id="Label4">
</asp:label>
</itemtemplate>
<edititemtemplate>
<asp:textbox runat="server" text='<%#
DataBinder.Eval(Container, "DataItem.ANI") %>' width="80px" id="txtPINANI">
</asp:textbox>
</edititemtemplate>
</asp:templatecolumn>
<asp:templatecolumn sortexpression="Priority"
headertext="Priority">
<itemtemplate>
<asp:label runat="server" text='<%#
DataBinder.Eval(Container, "DataItem.Priority") %>' id="Label5">
</asp:label>
</itemtemplate>
<edititemtemplate>
<asp:textbox runat="server" text='<%#
DataBinder.Eval(Container, "DataItem.Priority") %>' width="50px"
id="txtPINPriority">
</asp:textbox>
</edititemtemplate>
</asp:templatecolumn>
<asp:templatecolumn sortexpression="CallsLeft"
headertext="Calls Left">
<itemtemplate>
<asp:label runat="server" text='<%#
DataBinder.Eval(Container, "DataItem.CallsLeft") %>' id="Label6">
</asp:label>
</itemtemplate>
<edititemtemplate>
<asp:textbox runat="server" text='<%#
DataBinder.Eval(Container, "DataItem.CallsLeft") %>' width="50px"
id="txtPINCallCount">
</asp:textbox>
</edititemtemplate>
</asp:templatecolumn>
</columns>
</asp:datagrid><asp:label id="lblSortOrder" runat="server"
visible="False"></asp:label></td>

 
Reply With Quote
 
Elton Wang
Guest
Posts: n/a
 
      06-07-2005
Do you need to change client_ID or the client_ID(s) are from data source and
are bound in datgrid, to say PIN(s)?

If it's the second, you don't need do any thing in client-side (javascript).
It's very easy to catch it on server-side. The datagrid has powerful
function to obtain these data.


"John" <(E-Mail Removed)> wrote in message
news(E-Mail Removed)...
> here is the entire datagrid control, i belive i know what is wrong but i'm
> not exactly sure how to fix it. the client ID and PIN numer need to match

or
> the db wont find the correct listing and will therefore not delete

anything,
> so i need to work on the delete logic and the stored procedure's. if you
> have any ideas on how to make the delete logic look for the correct client
> id. i belive i can fix that part now that i think about it somemore. but

i
> cant seem to get my javascript to fire in IE 6.0, but it does fire in

mozilla
> but the page wont post back. i NEED this script to fire send a value
> (determinied by what button the user pushes) back to the server to

determine
> which stored procedure to run. Note: the if statement about which

procedure
> to run has not been written yet beacuse i cant get the first few steps to
> work right. so for now i'd be happy getting a value back for now and worry
> about using it later.
>
> <td><asp:datagrid id="dgPINList" runat="server" backcolor="White"
> width="550px" datakeyfield="PIN"
> allowsorting="True" autogeneratecolumns="False"
> bordercolor="#3D653D">
> <alternatingitemstyle
> backcolor="#DDDDDD"></alternatingitemstyle>
> <headerstyle cssclass="tableHeader"></headerstyle>
> <columns>
> <asp:editcommandcolumn buttontype="LinkButton"
> updatetext="<img src='images/icon_save.gif' width='16' height='16'

alt='Save
> Changes' border='0'>"
> canceltext="<img src='images/icon_cancel.gif' width='16'
> height='16' alt='Cancel Changes' border='0'>"
> edittext="<img src='images/icon_edit.gif' width='16'
> height='16' alt='Edit This Record' border='0'>"></asp:editcommandcolumn>
> <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>
> <asp:templatecolumn>
> <itemstyle horizontalalign="Center"></itemstyle>
> <itemtemplate>
> <asp:label runat="server" id="Label1">
> <a href='javascriptopupClientWindow(<%#
> DataBinder.Eval(Container, "DataItem.PIN") %>);'>
> <img src="images/icon_login.gif" border="0" alt="Login
> Under this PIN"></a></asp:label>
> </itemtemplate>
> </asp:templatecolumn>
> <asp:templatecolumn>
> <itemstyle horizontalalign="Center"></itemstyle>
> <itemtemplate>
> <a href='SwitchBoard.aspx?mode=archive&clientID=<%#
> Request.Params["clientID"] %>& =<%# DataBinder.Eval(Container,
> "DataItem.PIN") %>'>
> <img src="images/icon_archive.gif" width="16"
> height="16" border="0" alt="Archive this PIN"></a>
> </itemtemplate>
> </asp:templatecolumn>
> <asp:templatecolumn sortexpression="Pin" headertext="PIN">
> <itemtemplate>
> <a href='EditClient2.aspx?PIN=<%#
> DataBinder.Eval(Container, "DataItem.PIN") %>&clientID=<%#
> DataBinder.Eval(Container, "DataItem.ClientId") %>'>
> <%# DataBinder.Eval(Container, "DataItem.PIN") %>
> </a>
> </itemtemplate>
> </asp:templatecolumn>
> <asp:templatecolumn sortexpression="Description"
> headertext="Description">
> <itemtemplate>
> <asp:label runat="server" text='<%#
> DataBinder.Eval(Container, "DataItem.Description") %>' id="Label3">
> </asp:label>
> </itemtemplate>
> <edititemtemplate>
> <asp:textbox runat="server" text='<%#
> DataBinder.Eval(Container, "DataItem.Description") %>' width="180px"
> id="txtPINDescription">
> </asp:textbox>
> </edititemtemplate>
> </asp:templatecolumn>
> <asp:templatecolumn sortexpression="ANI" headertext="ANI">
> <itemtemplate>
> <asp:label runat="server" text='<%#
> DataBinder.Eval(Container, "DataItem.ANI") %>' id="Label4">
> </asp:label>
> </itemtemplate>
> <edititemtemplate>
> <asp:textbox runat="server" text='<%#
> DataBinder.Eval(Container, "DataItem.ANI") %>' width="80px"

id="txtPINANI">
> </asp:textbox>
> </edititemtemplate>
> </asp:templatecolumn>
> <asp:templatecolumn sortexpression="Priority"
> headertext="Priority">
> <itemtemplate>
> <asp:label runat="server" text='<%#
> DataBinder.Eval(Container, "DataItem.Priority") %>' id="Label5">
> </asp:label>
> </itemtemplate>
> <edititemtemplate>
> <asp:textbox runat="server" text='<%#
> DataBinder.Eval(Container, "DataItem.Priority") %>' width="50px"
> id="txtPINPriority">
> </asp:textbox>
> </edititemtemplate>
> </asp:templatecolumn>
> <asp:templatecolumn sortexpression="CallsLeft"
> headertext="Calls Left">
> <itemtemplate>
> <asp:label runat="server" text='<%#
> DataBinder.Eval(Container, "DataItem.CallsLeft") %>' id="Label6">
> </asp:label>
> </itemtemplate>
> <edititemtemplate>
> <asp:textbox runat="server" text='<%#
> DataBinder.Eval(Container, "DataItem.CallsLeft") %>' width="50px"
> id="txtPINCallCount">
> </asp:textbox>
> </edititemtemplate>
> </asp:templatecolumn>
> </columns>
> </asp:datagrid><asp:label id="lblSortOrder" runat="server"
> visible="False"></asp:label></td>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I wire up a custom button (non Select, Edit, Delete) in a datagrid that is a template column? AMT2K5 ASP .Net 0 03-06-2007 11:24 PM
Delete button on DataGrid not firing Jeff User ASP .Net 1 02-04-2006 10:36 AM
Finding the delete button in a datagrid hansiman ASP .Net 2 05-19-2005 12:46 PM
Problem with Delete and Edit button in Datagrid - will not reach handler Alex ASP .Net 2 04-22-2004 09:57 PM
Delete key doesn't delete when datagrid is bound to a disconnected table Fred Zolar ASP .Net Datagrid Control 0 04-01-2004 07:47 AM



Advertisments