Hi Rod,
The link button will post the page back to the server. In the link button's
click event, use Response.Redirect to redirect the user to your other page.
Now, the issue is how to communicate to the new page that it needs to run a
stored procedure and which one to run. There are several ways to accomplish
this.
Lets assume that the new page's load event has this variable:
Dim StoredProcToRun As String
* Query String
You can add information to the query string in your call to
Response.Redirect.
- In the link button click event:
Response.Redirect("NewPage.aspx?StoredProc=GetCustomers")
- In the new page load event:
If Not IsNothing(Request.QueryString("StoredProc")) Then
StoredProcToRun = Request.QueryString("StoredProc")
End If
We test if it is nothing before using it because an error will occur if it
is nothing and we try to use it.
* Session
You can instead redirect the user without the extra query string
information and supply the information with the session object. This
requires that you use sessions in your application.
- In the link button click event:
Session("StoredProc") = "GetCustomers"
Response.Redirect("NewPage.aspx")
- In the new page load event:
StoredProcToRun = Session("StoredProc")
* Cookies
Again skipping the extra query string information, you can supply the
information with a cookie. This requires that your users accept cookies.
- In the link button click event:
Response.Cookies.Add(New HttpCookie("StoredProc", "GetCustomers"))
Response.Redirect("NewPage.aspx")
- In the new page load event:
StoredProcToRun = Request.Cookies("StoredProc").Value
---
Does this answer your question?
Thank you, Mike
Microsoft, ASP.NET Support Professional
Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer's security.
This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------
From: "Rod Snyder" <
[email protected]>
Subject: link button and stored procedure
Date: Tue, 20 Jan 2004 20:44:07 -0500
Lines: 11
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <
[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
NNTP-Posting-Host: pcp05147733pcs.epensb01.pa.comcast.net 69.139.82.193
Path:
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.
phx.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet.webcontrols:17565
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
I'm trying to set up a page with an asp.net link button that would send a
user to a certain page and on page load execute a specific stored procedure
tied to the button on the previous page. The link would be in a nav area and
be something like "update". It would send the user to the main page and
execute the stored procedure associated with the update functionality. I'm
new to this area of .NET and would appreciate any suggestions,
directions