How to access properties of buttons/labels on a login control ?

  • Thread starter Thread starter craigkenisston
  • Start date Start date
C

craigkenisston

Using asp.net 2.0.

I have this code:
protected void Page_Init(object sender, EventArgs e)
{
Login1.LoginButtonText = MyFuncion();
string testtext = Login1.LoginButtonText;
}
It doesn't work.

protected void Page_Load(object sender, EventArgs e)
{
Login1.LoginButtonText = MyFuncion();
string testtext = Login1.LoginButtonText;
}
It doesn't work either.

I put a breakpoint on the "string testtext" line, and I see in the
debugger than the string is correctly being returned by the funcion
"myfunction()" and LoginButtonText property is supposedly to have this
value.
But on the page, the Login1.LoginButtonText is still containing the
default value I setup in design time.
Maybe I'm just not putting this code in the correct place and that's
why the text is set back to its original value later, I tried preinit,
but I got "object not set" errors there.

Maybe I should not use this LoginButtonText property that BTW, I get no
idea where it comes from. I'd like to use something like
"Login1.LoginButton.Text = myfunction()", but it seems the LoginButton
button is not accessible from nowhere.

So, how do I change the text of the loginbutton in the login form on
the fly ?
 
You have to drill into the template, find the control and set properties on
most controls. The button is internal to the control.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside of the box!
*************************************************
 

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

Back
Top