Populating a text field and then getting its value

I

Imran Aziz

Hello All,
I am populating a text field dynamic in my code, and its a read-only
textbox control. It populates it perfectly fine. but when I get its value
back in code I get an empty string any clues as to how to get this sorted
please ?

Here is how I set the value of the control.
txtTitle.Text = feed.Channels[0].Title;

and get it later

String strString = txtTitle.Text;

Any clues please ?

Imran.
 
G

Grant Merwitz

Thats a strange one.
Working fine for me:

ASPX:

<asp:TextBox id="TextBox1" runat="server" ReadOnly="True"
OnClick="Button1_Click"></asp:TextBox>
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button>

CS

void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
TextBox1.Text = "Hello";
}

void Button1_Click(object sender, System.EventArgs e)
{
Response.Write("Value: " + TextBox1.Text);
}

OUTPUT

Value: Hello


Try making a simple page like that and testing it
 
I

Imran Aziz

used the exact code, but does not work for me, the text value returned is
empty.
Imran.
Grant Merwitz said:
Thats a strange one.
Working fine for me:

ASPX:

<asp:TextBox id="TextBox1" runat="server" ReadOnly="True"
OnClick="Button1_Click"></asp:TextBox>
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button>

CS

void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
TextBox1.Text = "Hello";
}

void Button1_Click(object sender, System.EventArgs e)
{
Response.Write("Value: " + TextBox1.Text);
}

OUTPUT

Value: Hello


Try making a simple page like that and testing it


Imran Aziz said:
Hello All,
I am populating a text field dynamic in my code, and its a read-only
textbox control. It populates it perfectly fine. but when I get its value
back in code I get an empty string any clues as to how to get this sorted
please ?

Here is how I set the value of the control.
txtTitle.Text = feed.Channels[0].Title;

and get it later

String strString = txtTitle.Text;

Any clues please ?

Imran.
 
I

Imran Aziz

If I change the textbox property Readonly to false then it works perfectly
fine. I am using the latest Beta 2 release of .net framework.
Imran.

Grant Merwitz said:
Thats a strange one.
Working fine for me:

ASPX:

<asp:TextBox id="TextBox1" runat="server" ReadOnly="True"
OnClick="Button1_Click"></asp:TextBox>
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button>

CS

void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
TextBox1.Text = "Hello";
}

void Button1_Click(object sender, System.EventArgs e)
{
Response.Write("Value: " + TextBox1.Text);
}

OUTPUT

Value: Hello


Try making a simple page like that and testing it


Imran Aziz said:
Hello All,
I am populating a text field dynamic in my code, and its a read-only
textbox control. It populates it perfectly fine. but when I get its value
back in code I get an empty string any clues as to how to get this sorted
please ?

Here is how I set the value of the control.
txtTitle.Text = feed.Channels[0].Title;

and get it later

String strString = txtTitle.Text;

Any clues please ?

Imran.
 
G

Grant Merwitz

okay, i'm on v1.1

I have beta 2 on a machine here.
If i have time to test it before i go, i'll try run the example there

Imran Aziz said:
If I change the textbox property Readonly to false then it works
perfectly fine. I am using the latest Beta 2 release of .net framework.
Imran.

Grant Merwitz said:
Thats a strange one.
Working fine for me:

ASPX:

<asp:TextBox id="TextBox1" runat="server" ReadOnly="True"
OnClick="Button1_Click"></asp:TextBox>
<asp:Button id="Button1" runat="server"
Text="Button"></asp:Button>

CS

void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
TextBox1.Text = "Hello";
}

void Button1_Click(object sender, System.EventArgs e)
{
Response.Write("Value: " + TextBox1.Text);
}

OUTPUT

Value: Hello


Try making a simple page like that and testing it


Imran Aziz said:
Hello All,
I am populating a text field dynamic in my code, and its a read-only
textbox control. It populates it perfectly fine. but when I get its
value back in code I get an empty string any clues as to how to get this
sorted please ?

Here is how I set the value of the control.
txtTitle.Text = feed.Channels[0].Title;

and get it later

String strString = txtTitle.Text;

Any clues please ?

Imran.
 
I

Imran Aziz

Thanks a lot.
Imran.
Grant Merwitz said:
okay, i'm on v1.1

I have beta 2 on a machine here.
If i have time to test it before i go, i'll try run the example there

Imran Aziz said:
If I change the textbox property Readonly to false then it works
perfectly fine. I am using the latest Beta 2 release of .net framework.
Imran.

Grant Merwitz said:
Thats a strange one.
Working fine for me:

ASPX:

<asp:TextBox id="TextBox1" runat="server" ReadOnly="True"
OnClick="Button1_Click"></asp:TextBox>
<asp:Button id="Button1" runat="server"
Text="Button"></asp:Button>

CS

void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
TextBox1.Text = "Hello";
}

void Button1_Click(object sender, System.EventArgs e)
{
Response.Write("Value: " + TextBox1.Text);
}

OUTPUT

Value: Hello


Try making a simple page like that and testing it


Hello All,
I am populating a text field dynamic in my code, and its a read-only
textbox control. It populates it perfectly fine. but when I get its
value back in code I get an empty string any clues as to how to get
this sorted please ?

Here is how I set the value of the control.
txtTitle.Text = feed.Channels[0].Title;

and get it later

String strString = txtTitle.Text;

Any clues please ?

Imran.
 
G

Grant Merwitz

Sorry it took me so long to try this.

But it's working fine for me on a Machine running Beta 2


Imran Aziz said:
Thanks a lot.
Imran.
Grant Merwitz said:
okay, i'm on v1.1

I have beta 2 on a machine here.
If i have time to test it before i go, i'll try run the example there

Imran Aziz said:
If I change the textbox property Readonly to false then it works
perfectly fine. I am using the latest Beta 2 release of .net framework.
Imran.

Thats a strange one.
Working fine for me:

ASPX:

<asp:TextBox id="TextBox1" runat="server" ReadOnly="True"
OnClick="Button1_Click"></asp:TextBox>
<asp:Button id="Button1" runat="server"
Text="Button"></asp:Button>

CS

void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
TextBox1.Text = "Hello";
}

void Button1_Click(object sender, System.EventArgs e)
{
Response.Write("Value: " + TextBox1.Text);
}

OUTPUT

Value: Hello


Try making a simple page like that and testing it


Hello All,
I am populating a text field dynamic in my code, and its a
read-only textbox control. It populates it perfectly fine. but when I
get its value back in code I get an empty string any clues as to how
to get this sorted please ?

Here is how I set the value of the control.
txtTitle.Text = feed.Channels[0].Title;

and get it later

String strString = txtTitle.Text;

Any clues please ?

Imran.
 
I

Imran Aziz

Hum strange I am doing something wrong then, I guess I will try and use
labels instead of text boxes.
Thanks a lot for coming back to me on that.

Imran
Grant Merwitz said:
Sorry it took me so long to try this.

But it's working fine for me on a Machine running Beta 2


Imran Aziz said:
Thanks a lot.
Imran.
Grant Merwitz said:
okay, i'm on v1.1

I have beta 2 on a machine here.
If i have time to test it before i go, i'll try run the example there

If I change the textbox property Readonly to false then it works
perfectly fine. I am using the latest Beta 2 release of .net framework.
Imran.

Thats a strange one.
Working fine for me:

ASPX:

<asp:TextBox id="TextBox1" runat="server" ReadOnly="True"
OnClick="Button1_Click"></asp:TextBox>
<asp:Button id="Button1" runat="server"
Text="Button"></asp:Button>

CS

void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
TextBox1.Text = "Hello";
}

void Button1_Click(object sender, System.EventArgs e)
{
Response.Write("Value: " + TextBox1.Text);
}

OUTPUT

Value: Hello


Try making a simple page like that and testing it


Hello All,
I am populating a text field dynamic in my code, and its a
read-only textbox control. It populates it perfectly fine. but when I
get its value back in code I get an empty string any clues as to how
to get this sorted please ?

Here is how I set the value of the control.
txtTitle.Text = feed.Channels[0].Title;

and get it later

String strString = txtTitle.Text;

Any clues please ?

Imran.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top