473,657 Members | 2,426 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RegisterHiddenF ield() 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 RegisterHiddenF ield() function.

i.e.
Private Sub PartnerGrid_Ite mCommand(ByVal source As Object, ByVal e As
System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles
PartnerGrid.Ite mCommand
RegisterHiddenF ield("PartnerID ", _
PartnerGrid.Dat aKeys(e.Item.It emIndex)
If e.CommandName.T oString() = "Preview" Then
'Server.Transfe r("Somewhere" )
End If
End Sub

Now the problem here is when I call the RegisterHiddenF ield() 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 2424
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.A dd("PartnerId" , e.Item.ItemInde x)

Server.Transfer ("Somewhere" )

'---Retrieve the value on the next page...
Dim ItemIndex As Int32 = CType(Context.I tems.Item("Part nerId"), 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.goo gle.com...
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 RegisterHiddenF ield() function.

i.e.
Private Sub PartnerGrid_Ite mCommand(ByVal source As Object, ByVal e As
System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles
PartnerGrid.Ite mCommand
RegisterHiddenF ield("PartnerID ", _
PartnerGrid.Dat aKeys(e.Item.It emIndex)
If e.CommandName.T oString() = "Preview" Then
'Server.Transfe r("Somewhere" )
End If
End Sub

Now the problem here is when I call the RegisterHiddenF ield() 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
3085
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 void Page_Load(object sender, System.EventArgs e) { Page.RegisterHiddenField("__EVENTTARGET","SomeButtonOnThePage");
4
1791
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 does not appear on the Control Tree section of the trace. I put a normal hidden field on an aspx page and set it to run as a server control, and the control appears at the trace info. I have two questions about this: 1) Only server controls can...
0
1460
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 page, but not when it is inside an ascx. In the source code of the page, I can see that the ascx adds an prefix before the ID of the hidden field. This kind of thing is no problem when you are using javascript on objects such as buttons, that have a...
3
2658
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 affected (because I have javascript to change the web page at client side). In C#, I need such a code: private void btnEdit_Click(object sender, System.EventArgs e) {
0
2687
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 these values to be used by some client-side javascript. If I can't use the register methods here, how can I make the data grid's clicked values availble in the Page_Load's Postback? Thanks, Dave private void dgGrid_ItemCommand(Object src,...
4
2013
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 datagrid isn't going to work). On this page, people can update a variet of records. On submit, I want to then go in and update all of the records. Normally, I'd make each form element include a runat: server and then declare it in my codebhind so I...
2
5365
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 Page.RegisterHiddenField("myhiddenfield", "hidden") End If
3
1571
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 for me. I have another User Control which uses this technique and works. Can't think of what I am missing? --
2
5706
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 javascript function that uses the ClientID of the dynamic controls to perform certain operations on the client-side. With each partial page post back, I dynamically recreate the javascript function using the ClientIDs of the newly added controls....
0
8829
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8734
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8508
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8608
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7341
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6172
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4164
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2733
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 we have to send another system
2
1962
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.