Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 943
  • Last Modified:

ASP.Net/C# - storing repeater label text into a session variable or hash table etc?

I have a repeater and in the repeater I have a label.  I have this update ajax panel that is killing what I need to do.  So I need to somehow store to a table or something in session the control ID and the value and then be able to place it back into that control each time the page refreshes.
0
sbornstein2
Asked:
sbornstein2
  • 4
1 Solution
 
clinton_cunninghamCommented:
Have you considered using a hidden field?

<input type="hidden" value="Value That You Need to Store" id="KeyName">

This will sit on the page hidden from view, and you can simply update the value with your query, id, or any unique string field and then read it on page load and populate your table or somthing. It will retain the value you assign to it before the postback, so after the postback the value is persisted.

You can extract the hidden field's value by using the Params collection in the Request object, using a code line like this:

String strValue = Request.Params["KeyName"];


I'm not sure about storing a table in this field, but i'm thinking your just after persisting some sort of value between postbacks?

this page might help with a more detailed explanation - and examples of querystring. http://www.csharphelp.com/archives/archive184.html
0
 
sbornstein2Author Commented:
so this is what I have.  I have a repeater and then the control has to be in the repeater.  So the repeater is going to create seperate client id values for this control.  The best thing would be if I could do a find control on the clientid but it is not working for some reason unless the namingcontainer is needed etc.    If I use a hidden input field would the value go away on postback?
0
 
sbornstein2Author Commented:
if I dropped the input field into my repeater how would I populate it?  Is it request.forms or something?
0
 
sbornstein2Author Commented:
i would also still need to do a find control or append something to the control so I know what control name to fill as I loop through the repeater.
0
 
sbornstein2Author Commented:
thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now