viewstate lost when using querystring

M

Max

Is there anyway to preserve the current viewstate when a hyperlink is
clicked to the same page? I have a datagrid on "customers.aspx" but I want
to have several hyperlinks that do not post, they just querystring like
"customers.aspx?id=56" but once this happens, all the viewstate is lost or
reset.

-Max
 
J

Jose Marcenaro

If you have arguments (id=56) to be processed on the server side, and you
want the state preserved, you need a postback

Instead of using a regular Hyperlink control, use a LinkButton (same user
interface) and assign the arguments in its CommandArgument property.

On the click event of the LinkButton, you get the submitted argument as
follows:

string myArgs = ((LinkButton)sender).CommandArgument // C#
syntax

Dim myArgs as String = CType(sender, LinkButton).CommandArgument
' VB.NET Syntax
Regards

Jose
 

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

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top