Setting Text of a button

  • Thread starter Thread starter NEMA
  • Start date Start date
N

NEMA

Hello everyone,

i have a problem while setting the button text recently

for my case, i would like to set the text of the button on the aspx
page, i have write the code like below

<asp:button id="btn_submit" text='<%# GetText("abc.xml","btn_text")
%>' >

where the GetText is a function which will retrieve a string in xml
The page can run but the text cannot be display on the button. i am
sure that the function is work as i have tried it on the code-behind
like: btn_submit.text = GetText("abc.xml","btn_text") , it work fine
with no problem but it dont work while i try it in the aspx page.

Did anyone try it before and please give me some hints. Thanks everyone
 
Thanks

So how can i execute that function
i have also try <%= GetText("abc.xml","btn_text") %> but it is not
work too

<%# ... is a databinding expression. You need to call DataBind method to
execute it.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net




Hello everyone,
i have a problem while setting the button text recently
for my case, i would like to set the text of the button on the aspx
page, i have write the code like below
<asp:button id="btn_submit" text='<%# GetText("abc.xml","btn_text")
%>' >
where the GetText is a function which will retrieve a string in xml
The page can run but the text cannot be display on the button. i am
sure that the function is work as i have tried it on the code-behind
like: btn_submit.text = GetText("abc.xml","btn_text") , it work fine
with no problem but it dont work while i try it in the aspx page.
Did anyone try it before and please give me some hints. Thanks everyone- -

- -
 
Perhaps you should try another approach.
For example, in your Page_Load event you could use code like this:
btn_submit.Text = GetText("abc.xml","btn_text")
 
Just call the DataBind() method for the page and <%# .. %> will work

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin


NEMA said:
Thanks

So how can i execute that function
i have also try <%= GetText("abc.xml","btn_text") %> but it is not
work too

<%# ... is a databinding expression. You need to call DataBind method to
execute it.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net




Hello everyone,
i have a problem while setting the button text recently
for my case, i would like to set the text of the button on the aspx
page, i have write the code like below
<asp:button id="btn_submit" text='<%# GetText("abc.xml","btn_text")
%>' >
where the GetText is a function which will retrieve a string in xml
The page can run but the text cannot be display on the button. i am
sure that the function is work as i have tried it on the code-behind
like: btn_submit.text = GetText("abc.xml","btn_text") , it work fine
with no problem but it dont work while i try it in the aspx page.
Did anyone try it before and please give me some hints. Thanks
everyone- -

- -
 
Back
Top