Hi;
I ask a question.I want to write a server control component for asp.net.For example,I want to override textbox control.I want to make a numeric textbox control.Numeric textBox doesnt allow the user to enter nonnumeric value.
I just did this with javascript but I didnt integrate javascript code into web control component project.How can I do this?
Thanks,
What you can do is create a new class inherit from TextBox, then override the OnPreRender use something to :
this.Attributes.Add("onKeyPress", "script name here");
As an example!
And make sure to create the scripts and register them on the page using the Page.ClientScript.RegisterStartupScript or so.
All of this is done in the PreRender method.
Does that help?
Regards
Thanks,haidar_bilal
I understand this but I want to create web control and I add it to toolbox and I use it like other control such as TextBox,Button.My control is inherited from TextBox and I want to create Numeric TextBox control.
Note:I create a project like this: I open a project in .net and choose the c# web control library.
Thanks,
0 comments:
Post a Comment