473,385 Members | 1,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

OnClick LinkButton

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
Sep 5 '07 #1
5 5655
that all depends on how you're displaying the data and what's available for
it, to use
for instance, are you using a a gridview ?

David Wier
http://aspnet101.com
http://iWritePro.com
"Gabe Matteson" <gm*******@inquery.biz.nospamwrote in message
news:Ov**************@TK2MSFTNGP05.phx.gbl...
>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

Sep 5 '07 #2
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.

"David Wier" <da*******@davidwier.nospam.comwrote in message
news:u3**************@TK2MSFTNGP02.phx.gbl...
that all depends on how you're displaying the data and what's available
for it, to use
for instance, are you using a a gridview ?

David Wier
http://aspnet101.com
http://iWritePro.com
"Gabe Matteson" <gm*******@inquery.biz.nospamwrote in message
news:Ov**************@TK2MSFTNGP05.phx.gbl...
>>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


Sep 5 '07 #3
You could save yourself a lot of time and code by using a GridView.

David
"Gabe Matteson" <gm*******@inquery.biz.nospamwrote in message
news:uP**************@TK2MSFTNGP03.phx.gbl...
>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.

"David Wier" <da*******@davidwier.nospam.comwrote in message
news:u3**************@TK2MSFTNGP02.phx.gbl...
>that all depends on how you're displaying the data and what's available
for it, to use
for instance, are you using a a gridview ?

David Wier
http://aspnet101.com
http://iWritePro.com
"Gabe Matteson" <gm*******@inquery.biz.nospamwrote in message
news:Ov**************@TK2MSFTNGP05.phx.gbl...
>>>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



Sep 5 '07 #4
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" <gm*******@inquery.biz.nospamwrote in message
news:uP**************@TK2MSFTNGP03.phx.gbl...
>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.

"David Wier" <da*******@davidwier.nospam.comwrote in message
news:u3**************@TK2MSFTNGP02.phx.gbl...
>that all depends on how you're displaying the data and what's available
for it, to use
for instance, are you using a a gridview ?

David Wier
http://aspnet101.com
http://iWritePro.com
"Gabe Matteson" <gm*******@inquery.biz.nospamwrote in message
news:Ov**************@TK2MSFTNGP05.phx.gbl...
>>>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



Sep 5 '07 #5
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" <gt****@cardone.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
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" <gm*******@inquery.biz.nospamwrote in message
news:uP**************@TK2MSFTNGP03.phx.gbl...
>>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(objSQLDataReade r(0))%>"
runat="server">Delete</asp:LinkButton></td>

thank you.

"David Wier" <da*******@davidwier.nospam.comwrote in message
news:u3**************@TK2MSFTNGP02.phx.gbl...
>>that all depends on how you're displaying the data and what's available
for it, to use
for instance, are you using a a gridview ?

David Wier
http://aspnet101.com
http://iWritePro.com
"Gabe Matteson" <gm*******@inquery.biz.nospamwrote in message
news:Ov**************@TK2MSFTNGP05.phx.gbl...
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



Sep 6 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dave | last post by:
Hi, I have a datagrid with a Templated column below. I want to execute some javascript before the postback to show a hidden "div" tag with static message of "Please Wait..." since the query takes...
5
by: George Durzi | last post by:
I currently have an href inside of an asp:repeater <a href='<%# String.Concat("PDFReader.aspx?id=", DataBinder.Eval(Container.DataItem, "ProductUniqueId")) %>' target="_blank">View</a> ...
2
by: Corno | last post by:
Hi all, I have a page with a table of which the rows have to be added dynamically. What I also want is 'code behind' the onclick event of a row (the page should be posted back to the server,...
3
by: tshad | last post by:
I have a page where I want to set my linkbutton text using a class and cannot seem to get it to work using CSSClass, but it works fine using "ForeColor". Why is that? Here is the code:...
3
by: MRW | last post by:
I have a simple linkbutton and a function when it's clicked. It works perfectly in a regular .aspx page. However, when I place it inside the ContentPlaceHolder, it no longer works. It does...
3
by: John | last post by:
Hi I have been trying to change the css class of a linkbutton without succes ( I dont want to change the cssclass property). Maybe somebody knowshow to do this?? th.John <%@ Page...
2
by: =?Utf-8?B?Uml0YUc=?= | last post by:
I posted this question in the C# discussion group but am posting it here also since ASP is involved. I'm new to C# and need some help regarding an onClick event not firing. I have a data grid...
3
by: =?Utf-8?B?SmFrb2IgTGl0aG5lcg==?= | last post by:
I have two sets of search criteria on my page. They are placed inside two DIV tags made visible/hidden by a client script. In each DIV tag I have a LinkButton that performs the search from each...
0
by: jeenajos | last post by:
Hi all, I dono wat happen to my code. It was working quite fine. But now link button click event is not firing. This linkbutton was used for navigation; first,next,previous,last. Can anyone...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.