Click here to Skip to main content
15,912,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends,
how to set the Usercontrol properties on Page_Init() event of .ascx page.
my properties is like below:
C#
public string Tablename
   {
       get
       {
           return this.tablename;
       }
       set
       {
           this.tablename = value;
       }
   }
protected void Page_Init(object sender, EventArgs e)
    {

    }

regards,
Aamir
Posted
Updated 25-Jul-12 18:09pm
v2

You set them, that is all. The main reason to do it in init is to make sure it happens before any page load events fire, but you just set them. Where is the issue ?
 
Share this answer
 
Comments
aamir07 26-Jul-12 1:04am    
the issue is i am unable to get the values on aspx page.
example: i had declare a property for textbox MaxLength
public int MaxLength
{
get
{
return this.length;
}
set
{
this.length = value;
}
}

when i set the textbox Maxlentgh property as 10 in .aspx page, it doesn't work it take more values than 10
Christian Graus 26-Jul-12 2:01am    
Have you checked to see how it's rendered ? Have you set a breakpoint anywhere ? It feels to me like you wrote some code, it didn't work, so you posted here, without looking at it to understand what was happening.
got Answer to my Question.
on page_load()of the ascx.cs page
i have to call the,
TextBox.Maxlength=length
and its working :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900