Dear Sir,

I like to thankx to Dean Fiala, you have solved my
problem. Once again thankx


 --- Dean Fiala <[EMAIL PROTECTED]> wrote: > You have to
remember that each time you press the
> button, you are posting
> back to the server, and the server creates a new
> instance of the page. hence
> any module level variables are reinitialized.  If
> you want to maintain state
> between calls to the page you must either store the
> value on the page (in a
> control or in Viewstate) or in a session variable.
> 
> In this case storing on the page would be the best
> approach.
> 
> You can either store the string directly in the
> lblMessage control...
> 
> Sub SubmitBtn_AddValue(Sender as Object, E as
> EventArgs)
> 
> Dim WorkExperience as String
> 
> WorkExperience + = "IT Officer"
> WorkExperience + = "01,"
> WorkExperience + = "2002,"
> WorkExperience + = "02,"
> WorkExperience + = "2002,"
> WorkExperience + = "Hello2,"
> WorkExperience + = "+"
> 
> 
> lblMessage.Text += WorkExperience
> 
> End Sub
> 
> or in a viewstate variable...
> 
> 
> Sub SubmitBtn_AddValue(Sender as Object, E as
> EventArgs)
> 
> Dim WorkExperience as String
> 
> if not isNothing(ViewState("SavedWorkExperience"))
> then
>       WorkExperience = ViewState("SavedWorkExperience")
> End if
> 
> WorkExperience + = "IT Officer"
> WorkExperience + = "01,"
> WorkExperience + = "2002,"
> WorkExperience + = "02,"
> WorkExperience + = "2002,"
> WorkExperience + = "Hello2,"
> WorkExperience + = "+"
> 
> 
> lblMessage.Text += WorkExperience
> 
> ViewState("SavedWorkExperience") = WorkExperience
> 
> End Sub
> 
> HTH,
> 
> Dean Fiala
> -----------------------------
> Very Practical Software, Inc.
> http://www.vpsw.com/links.aspx
> 
> 
> 
> -----Original Message-----
> From: Mustafa Ali Bamboat
> [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, May 18, 2004 7:06 AM
> To: [EMAIL PROTECTED]
> Subject: [AspNetAnyQuestionIsOk] How to store
> multiple values in a
> string without overriding the pervious one
> 
> 
> Hi Friends,
> 
> I am new user of ASP.NET. I'm trying to store the
> multiple values in
> a string, but very time it override the pervious
> value whenever I
> call the function through a command button.
> 
> Please help me out.
> 
> Here I also enclosing the sample coding for your
> reference
> 
> <[EMAIL PROTECTED] Language=VB Debug=True %>
> <Script runat="server">
> 
> Dim WorkExperience as String
> 
> 
> Sub Page_Load(ByVal Sender as Object, ByVal E as
> EventArgs)
> 
> 
> lblMessage.Text = "Press a button !"
> 
> WorkExperience +=" Hello !"
> 
> End Sub
> 
> 
> 
> Sub SubmitBtn_AddValue(Sender as Object, E as
> EventArgs)
> 
> 
> 
> WorkExperience + = "IT Officer"
> WorkExperience + = "01,"
> WorkExperience + = "2002,"
> WorkExperience + = "02,"
> WorkExperience + = "2002,"
> WorkExperience + = "Hello2,"
> WorkExperience + = "+"
> 
> 
> lblMessage.Text= WorkExperience
> 
> End Sub
> 
> </Script>
> 
> <html>
> <body>
> <form runat="server">
> <asp:Label
> id="lblMessage"
> Text=""
> runat="server"
> />
> <BR>
> <BR>
> <BR>
> <BR>
> <BR>
> <BR>
> <asp:Button
> id="butAlone"
> text="Add Value"
> OnClick="SubmitBtn_AddValue"
> runat="server"
> />
> 
> <BR>
> <BR>
> </form>
> </body>
> </html>
> 
> Try to run the above cited code. You will find a
> button named
> as "Add Value", if u press this button it will
> display a dummy
> value, now I want that if you press this Add Value
> more than once
> time then it must display the dummy value
> respectively.
> 
> For Example: Press this button 3 times then it must
> show the same
> value 3 times.
> 
> Please reply me soon because all my work is halt due
> to this problem
> 
> Looking forward to your reply...
> 
> Regards,
> Mustafa Bamboat
> [EMAIL PROTECTED]
> 
> 
> 
> 
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> 
>  

________________________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping" 
your friends today! Download Messenger Now 
http://uk.messenger.yahoo.com/download/index.html


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/saFolB/TM
---------------------------------------------------------------------~->

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
     [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 

Reply via email to