Here is the scenario I have.
I have different panels in my web page when i click next button the panels visibilty changes.
first time except panel1 all other panels are invisible.
when i click next panel1 becomes invisible and panel2 becomes invisible. and goes on...
issue
--
I have one text box in panel1. it not mandatory field. when i click on next it hides the panel1 and displays the panel2. In panel2 i have a webgrid control. when i click on that grid control it populates the data in a textbox in panel2.
this is also fine - working perfect.
after it populates the textbox on panel2 and if textbox in panel1 is blank then it should populate the textbox in panle1 with same value as textbox in panel2. this is also not a problem.
when user has not entered any data into textbox1 in panle1 then whenever i am changing the value in textbox2 in panel2 the value of textbox in panel1 also needs to be changed. but if there is some text entered by user then i should not change the value of textbox in panle1.
I can do by two ways one is by having a session variable (capture the intial value) and compare against the session variable to populate the value in textbox of panel one.
other way is using the local variable (class level) and do the same.
now my question is wat is the difference between these two. and wat is the advantage of these.
local variable is not working for me here is the code i am using. I have highligted the lines in red color. pls do help me
declaration part
-------
Namespace Promotions.WebPromotions.WEBUI
PublicClass EventCreate
Inherits PageBase
Protected EventDescAsString
' assigning value part
----------
PrivateSub StoreEventDesc()
Dim TxtEventDescAs Infragistics.WebUI.WebDataInput.WebTextEdit =CType(Step1.FindControl("txtEventDesc"), Infragistics.WebUI.WebDataInput.WebTextEdit)EventDesc = TxtEventDesc.Text
EndSub
'validating part
-------------
IfEventDesc = ""Then
If strDesc.Length > 32Then
TxtEventDesc.Text = strDesc.Substring(0, 32)
Else
TxtEventDesc.Text = strDesc.ToString
EndIf
EndIf
A class level variable is only "alive" as long as the page is being processed on the server. That is when you view the page in your browser, the variable doesn't exist any more. A session variable is a type of variable where it can stay "alive" throughout multiple postbacks and is unique to each user visiting your site.
You will have to use a session variable (or viewstate, cache, application, context.items collection) if you ever want to save information across postbacks.
Thanks for response. I gto resolved the issue,
0 comments:
Post a Comment