473,320 Members | 1,976 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Question on viewstate workaround technique

I have a Datalist which contains linkbuttons. In order to get the
information about the clicked linkbutton I have been enabling the viewstate.
I have noticed that the size of the viewstate for datalists is quite large
(about 8000 character) even though the datalist ranges about 20 items long.
As a workaround I have thought about but haven't actually tried is to
disable the viewstate, then use the Request.Form("__EVENTARGET") and use the
control ID to determine which control has been click and process from there.
I also forgo getting any command arguments etc. The trade off here is page
bloat. What do you think of that method? Are there other ways to do this?
Thanks for any insight.

Mike
Nov 18 '05 #1
3 1090
why can't you switch off the viewstate, and put a bit of ye olde client
script on the control in question, this can still call back to the server
side page?

i've had to use something like this to detect when someone presses 'enter'

"vMike" wrote:
I have a Datalist which contains linkbuttons. In order to get the
information about the clicked linkbutton I have been enabling the viewstate.
I have noticed that the size of the viewstate for datalists is quite large
(about 8000 character) even though the datalist ranges about 20 items long.
As a workaround I have thought about but haven't actually tried is to
disable the viewstate, then use the Request.Form("__EVENTARGET") and use the
control ID to determine which control has been click and process from there.
I also forgo getting any command arguments etc. The trade off here is page
bloat. What do you think of that method? Are there other ways to do this?
Thanks for any insight.

Mike

Nov 18 '05 #2

"adolf garlic" <ad*********@discussions.microsoft.com> wrote in message
news:AA**********************************@microsof t.com...
why can't you switch off the viewstate, and put a bit of ye olde client
script on the control in question, this can still call back to the server
side page?

i've had to use something like this to detect when someone presses 'enter'

"vMike" wrote:
I have a Datalist which contains linkbuttons. In order to get the
information about the clicked linkbutton I have been enabling the viewstate. I have noticed that the size of the viewstate for datalists is quite large (about 8000 character) even though the datalist ranges about 20 items long. As a workaround I have thought about but haven't actually tried is to
disable the viewstate, then use the Request.Form("__EVENTARGET") and use the control ID to determine which control has been click and process from there. I also forgo getting any command arguments etc. The trade off here is page bloat. What do you think of that method? Are there other ways to do this? Thanks for any insight.

Mike

Thanks. Sometimes the simple things escape me.

Nov 18 '05 #3
I was in the middle of reading this when you posted
http://www.ondotnet.com/pub/a/dotnet...15/aspnet.html

It has a couple of good ideas about asp.net & client script

"vMike" wrote:

"adolf garlic" <ad*********@discussions.microsoft.com> wrote in message
news:AA**********************************@microsof t.com...
why can't you switch off the viewstate, and put a bit of ye olde client
script on the control in question, this can still call back to the server
side page?

i've had to use something like this to detect when someone presses 'enter'

"vMike" wrote:
I have a Datalist which contains linkbuttons. In order to get the
information about the clicked linkbutton I have been enabling the viewstate. I have noticed that the size of the viewstate for datalists is quite large (about 8000 character) even though the datalist ranges about 20 items long. As a workaround I have thought about but haven't actually tried is to
disable the viewstate, then use the Request.Form("__EVENTARGET") and use the control ID to determine which control has been click and process from there. I also forgo getting any command arguments etc. The trade off here is page bloat. What do you think of that method? Are there other ways to do this? Thanks for any insight.

Mike

Thanks. Sometimes the simple things escape me.

Nov 18 '05 #4

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

Similar topics

3
by: G-Fit | last post by:
Hello group, I am trying to do something simple (or so do I think). A web page, with a Button, each click on it adding a row in a Table below. The result I get is that the Table always has only...
1
by: John | last post by:
Hi all, I have a problem with viewstate being maintained. I use LoadControl to load a user control and the data is sent down to the client correctly. However, when I change some data and post...
1
by: Vlad | last post by:
Hi all. I use ViewState on most of my pages. Sometimes heavily. Works great, I love it. But most of the asp.net sites I visit seem to ignore it. They don't even include form tag in html and use...
8
by: Invalidlastname | last post by:
Hi, We are developing an asp.net application, and we dynamically created certain literal controls to represent some read-only text for certain editable controls. However, recently we found an issue...
5
by: Craig Buchanan | last post by:
I'm using a viewstate key/value to store a serialized instance of a class. If I redirect to another aspx page, the viewstate is lost. Is this the intended behavior of the viewstate? Is there a...
4
by: Christian Ista | last post by:
Hello, I have 2 questions : 1. On an ASP.NET page I have several controls (5 TextBox, 1 Dropdown and 1 button) Only the dropdown is AutoPostBack = true, the TextBox are SingleLine When I...
6
by: John | last post by:
Hi all, I am using dynamic user controls within my web app and these controls are loaded into placeholders via the LoadControl method. My problem is this: I have usercontrolA loaded into a...
7
by: GS | last post by:
Hello, I'm receiving The state information is invalid for this page and might be corrupted error message when running code below. This happens on second post back. Why is it happening? My...
0
by: bminder | last post by:
I have a web user control that contains a serializable class. I persist this class in viewstate, but on postback, the viewstate is null. Is this behavior by design? This technique works fine on...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.