OnClick LinkButton

G

Gabe Matteson

I would like the linkbutton when it is clicked to exectute a delete sql
statement on the current page.

etc.
onclick="btndelete_onclick"

how do i get the linkbutton to pass the database id column value to the sub
procedure so it can delete the record? thanks for any help
 
G

Gabe Matteson

I just using a sql data reader and outputting the data into a regular html
table using

<%Response.Write(objSQLDataReader(0) %>

i was hoping there was a way to put

<asp:LinkButton ID="lbtnDelete" onclick="btnDelete"
CommandArgument="<%Response.Write(objSQLDataReader(0))%>"
runat="server">Delete</asp:LinkButton></td>

thank you.
 
G

George Ter-Saakov

You can always do
iRecordId= Request["__EVENTARGUMENT"];

If you look at the source code of the HTML created you will notice that
CommandArgument parameter end up being moved to hidden field with name
__EVENTARGUMENT


George.
 
G

Gabe Matteson

Ah I got it into a gridview, lots of time saved.. i have one column that is
an image column and 3 other data columns. when i click edit, it trieds to
edit the graphic column. is there a way that i can disable edits for that
column?

George Ter-Saakov said:
You can always do
iRecordId= Request["__EVENTARGUMENT"];

If you look at the source code of the HTML created you will notice that
CommandArgument parameter end up being moved to hidden field with name
__EVENTARGUMENT


George.


Gabe Matteson said:
I just using a sql data reader and outputting the data into a regular html
table using

<%Response.Write(objSQLDataReader(0) %>

i was hoping there was a way to put

<asp:LinkButton ID="lbtnDelete" onclick="btnDelete"
CommandArgument="<%Response.Write(objSQLDataReader(0))%>"
runat="server">Delete</asp:LinkButton></td>

thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top