Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2007

Tip: Looking for answers? Try searching our database.

OnClick LinkButton

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gabe Matteson - 05 Sep 2007 16:44 GMT
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
David Wier - 05 Sep 2007 17:08 GMT
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

>I would like the linkbutton when it is clicked to exectute a delete sql
>statement on the current page.
[quoted text clipped - 4 lines]
> 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
Gabe Matteson - 05 Sep 2007 17:14 GMT
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.

> that all depends on how you're displaying the data and what's available
> for it, to use
[quoted text clipped - 12 lines]
>> 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
David C - 05 Sep 2007 19:58 GMT
You could save yourself a lot of time and code by using a GridView.

David
>I just using a sql data reader and outputting the data into a regular html
>table using
[quoted text clipped - 25 lines]
>>> 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
George Ter-Saakov - 05 Sep 2007 21:37 GMT
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.

>I just using a sql data reader and outputting the data into a regular html
>table using
[quoted text clipped - 25 lines]
>>> 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
Gabe Matteson - 06 Sep 2007 03:38 GMT
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?

> You can always do
> iRecordId= Request["__EVENTARGUMENT"];
[quoted text clipped - 34 lines]
>>>> 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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.