473,503 Members | 2,322 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RegisterHiddenField() Not Updating After PostBack

I have a datagrid with a button column that displays some partner
info. i.e. PartnerId, PartnerName ... The button column has a button
that when the user clicks it they are redirected or server.transfer to
a different page where I would like to pass the PartnerId. I could do
this very easy with a QueryString, but would rather not display this
info in the URL. I want to pass this by creating a form variable
using the RegisterHiddenField() function.

i.e.
Private Sub PartnerGrid_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
PartnerGrid.ItemCommand
RegisterHiddenField("PartnerID", _
PartnerGrid.DataKeys(e.Item.ItemIndex)
If e.CommandName.ToString() = "Preview" Then
'Server.Transfer("Somewhere")
End If
End Sub

Now the problem here is when I call the RegisterHiddenField() the page
is not Posted again before the Server.Transfer so the value of
"PartnerId" is never updated. How do I repost this page so this value
is updated before I Server.Transfer?
Nov 18 '05 #1
1 2406
Pete,

There is a better way.

If you add your value to the page context object it will be passed to the
new page on server.transfer.

Do so like this:

Context.Items.Add("PartnerId", e.Item.ItemIndex)

Server.Transfer("Somewhere")

'---Retrieve the value on the next page...
Dim ItemIndex As Int32 = CType(Context.Items.Item("PartnerId"), Int32)

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Pete Mahoney" <la***********@students.uwlax.edu> wrote in message
news:18**************************@posting.google.c om...
I have a datagrid with a button column that displays some partner
info. i.e. PartnerId, PartnerName ... The button column has a button
that when the user clicks it they are redirected or server.transfer to
a different page where I would like to pass the PartnerId. I could do
this very easy with a QueryString, but would rather not display this
info in the URL. I want to pass this by creating a form variable
using the RegisterHiddenField() function.

i.e.
Private Sub PartnerGrid_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
PartnerGrid.ItemCommand
RegisterHiddenField("PartnerID", _
PartnerGrid.DataKeys(e.Item.ItemIndex)
If e.CommandName.ToString() = "Preview" Then
'Server.Transfer("Somewhere")
End If
End Sub

Now the problem here is when I call the RegisterHiddenField() the page
is not Posted again before the Server.Transfer so the value of
"PartnerId" is never updated. How do I repost this page so this value
is updated before I Server.Transfer?

Nov 18 '05 #2

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

Similar topics

1
3074
by: Matthew Wieder | last post by:
Hi - I wanted to capture the enter button on a form since I have a datagrid with the first column being a delete button and if someone hits enter it deletes the first record. I coded: private...
4
1784
by: Erik Cruz | last post by:
Hi. I am creating a custom control that uses the RegisterHiddenField method to insert a hidden field on a page. When I tried to see the value of the hidden field on a trace, I noticed that it...
0
1451
by: Francis | last post by:
Hi all, I am writing a .cs component that sets RegisterHiddenField on the server side and generates javascript to execute on the client side. It works when the component is directly in the...
3
2645
by: Guogang | last post by:
In a .aspx web page, I created a button that will do a postback What I want to do: let the button do postback, and process the postback data in my code behind, but the client side's page won't be...
0
2677
by: Dave | last post by:
Are there any known restrictions on where Page.RegisterHiddenField will work? It seems to only work in the Page_Load event...My code below fails to render it in the page's source I would like...
4
1993
by: Darrel | last post by:
I'm creating a table that contains multiple records pulled out of the database. I'm building the table myself and passing it to the page since the table needs to be fairly customized (ie, a...
2
5355
by: ashish | last post by:
If i want to add a hidden field on the page, how can i check whether that hidden field exists ? for example if i do If Page.FindControl("myhiddenfield") Is Nothing Then...
3
1565
by: John Smith | last post by:
I am having a brain fart today.... How do you set a default button within a User Control? I am using "Page.RegisterHiddenField("__EVENTTARGET", "btnSubmit")" but it does not seem to be working...
2
5685
by: =?Utf-8?B?TUNN?= | last post by:
I have an asp.net page that contains an update panel. Within the update panel, controls get added dynamically. During partial page post backs the controls within the panel will change. I have a...
0
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7357
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5598
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1522
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.