Click here to Skip to main content
16,004,782 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: How to convert a single http page into https using SSL in IIS? Pin
Expert Coming8-Jun-07 22:24
Expert Coming8-Jun-07 22:24 
GeneralRe: How to convert a single http page into https using SSL in IIS? Pin
vijay_838-Jun-07 23:05
vijay_838-Jun-07 23:05 
GeneralRe: How to convert a single http page into https using SSL in IIS? Pin
Expert Coming8-Jun-07 23:57
Expert Coming8-Jun-07 23:57 
GeneralRe: How to convert a single http page into https using SSL in IIS? Pin
vijay_839-Jun-07 1:33
vijay_839-Jun-07 1:33 
GeneralRe: How to convert a single http page into https using SSL in IIS? Pin
Expert Coming9-Jun-07 10:57
Expert Coming9-Jun-07 10:57 
QuestionError while uploading Pin
Prakash_Mishra8-Jun-07 18:54
Prakash_Mishra8-Jun-07 18:54 
AnswerRe: Error while uploading Pin
Sathesh Sakthivel8-Jun-07 18:59
Sathesh Sakthivel8-Jun-07 18:59 
Questionvariable scope Pin
AesopTurtle8-Jun-07 15:26
AesopTurtle8-Jun-07 15:26 
Hi,

I have been facing the variable scope problem since I started coding in ASP.NET (C#).
A variable I declare globally seems to be reset whenever it gets out of a function block.
For example, I have a label control named "lblURL" and a button named "cmdShow" on a web form with the following code:

<br />
public class MyClass: System.Web.UI.Page {<br />
    private string _url = "";<br />
<br />
    private void Page_Load(object sender, System.EventArgs e) {<br />
        this.SetUrl();<br />
    }<br />
<br />
    private void SetUrl(){<br />
        _url = "http://www.myWebSite.com";<br />
    }<br />
<br />
    private void cmdShow_Click(object sender, System.EventArgs e) {<br />
        this.lblURL.Text = _url;<br />
    }<br />
}<br />


When clicking on a button, I expect the label to display "http://www.myWebSite.com".
But it turns out to be blank.
I have tried debugging and found that the _url variable has been set properly in the SetUrl function.
But the value is gone after I click the button (_url = "" in cmdShow_Click() function).
Personally, I think it's the IsPostBack issue since I've never had this kind of problem with Windows Form programming.
But I don't know how to solve it. Cry | :((

Someone please tell me how it works and how to solve it.


KiT

Never wait for a chance to come, Believe in your own potential and go get it!

AnswerRe: variable scope Pin
Arun.Immanuel8-Jun-07 16:59
Arun.Immanuel8-Jun-07 16:59 
GeneralRe: variable scope Pin
AesopTurtle10-Jun-07 15:48
AesopTurtle10-Jun-07 15:48 
GeneralRe: variable scope Pin
Arun.Immanuel10-Jun-07 16:35
Arun.Immanuel10-Jun-07 16:35 
AnswerRe: variable scope Pin
Guffa8-Jun-07 23:07
Guffa8-Jun-07 23:07 
GeneralRe: variable scope Pin
AesopTurtle10-Jun-07 15:56
AesopTurtle10-Jun-07 15:56 
QuestionTrying to avoid the alert prompt while exporting data-table to Excel 2007 Pin
Mohamed Arif8-Jun-07 12:50
Mohamed Arif8-Jun-07 12:50 
AnswerRe: Trying to avoid the alert prompt while exporting data-table to Excel 2007 Pin
Mohamed Arif8-Jun-07 19:14
Mohamed Arif8-Jun-07 19:14 
QuestionGrid View Hyperlinks Pin
seemamltn8-Jun-07 11:07
seemamltn8-Jun-07 11:07 
QuestionConfigure Microsoft Internet Information Services Pin
Agbe8-Jun-07 10:48
Agbe8-Jun-07 10:48 
AnswerRe: Configure Microsoft Internet Information Services Pin
Felipe Dalorzo8-Jun-07 11:18
Felipe Dalorzo8-Jun-07 11:18 
GeneralRe: Configure Microsoft Internet Information Services Pin
Agbe8-Jun-07 14:14
Agbe8-Jun-07 14:14 
GeneralRe: Configure Microsoft Internet Information Services Pin
Felipe Dalorzo9-Jun-07 3:42
Felipe Dalorzo9-Jun-07 3:42 
Questionstoring data into xml file from asp.net app Pin
gopalkatla8-Jun-07 9:22
gopalkatla8-Jun-07 9:22 
AnswerRe: storing data into xml file from asp.net app Pin
Venk2598-Jun-07 17:59
Venk2598-Jun-07 17:59 
Questiontop 10 values Pin
vasini8-Jun-07 8:58
vasini8-Jun-07 8:58 
AnswerRe: top 10 values Pin
Not Active8-Jun-07 9:13
mentorNot Active8-Jun-07 9:13 
AnswerRe: top 10 values Pin
Arun.Immanuel8-Jun-07 17:27
Arun.Immanuel8-Jun-07 17:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.