|
How to Trap Key-Press for validating each digits in Text Box.
I want help for this with C# coding.
Its Amazing World of ASP.NET C#
|
|
|
|
|
Just validate everything at the end. Before you do anything with the data. If you were to hook on to keypress you would create way too many postbacks.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Try using javascript. This is how you should do......
TextBox1 txt=new TextBox();
txt.Attributes.Add("onkeypress","return ValidateForm(event)";
In javascript
function ValidateForm(e)
{
var unicode=e.charCode? e.charCode : e.keyCode //determine keycode
if ((unicode>=48&&unicode<=57)// Allow only numbers
return true;
else
return false;
}
|
|
|
|
|
Use a RegularExpression validator control with the RegEx "^\d$"
only two letters away from being an asset
|
|
|
|
|
|
I think you can put a semi column after one and start the next right after. What two types are you trying to do? Usually you can combine them.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Or you could just create two queries & call both in code one after the other.
|
|
|
|
|
Or create a stored procedure that can execute 2 queries.
Regards,
Arun Kumar.A
|
|
|
|
|
Thank for you taking ur time to help me
|
|
|
|
|
OnPreInit() and Init() wat is the difference..A control is intialized to its design defaults and postback data is not available in both cases then wat is the major difference between them..
LoadViewState and LoadPostBackData..i am really confused
protected override void LoadViewState(object savedState)
{
base.LoadViewState(savedState);
}
This event is never getting fired for me
if a textbox value is changed in a button click. Who is responsible for storing the textbox value.
what is diff b/w data stored in view state and data stored in a control that implements IPostBackDataHandler.
|
|
|
|
|
The major difference is that preinit is fired first. It was added just to give finer grained control.
LoadViewState won't fire unless you're posting back, as there can't be any viewstate to load.
vikasviswan wrote: if a textbox value is changed in a button click. Who is responsible for storing the textbox value.
It will be stored in viewstate, so long as viewstate is turned on for the page and the control.
vikasviswan wrote: what is diff b/w data stored in view state and data stored in a control that implements IPostBackDataHandler.
Probably nothing, viewstate is the only state in town, except control state, which is just a subset of what 1.1 stored in viewstate, so you can turn some of it off and not the rest. Control state is really still viewstate.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i have a textbox and 2 buttons.
In the first button click ,i am changing the textbox value to hello.
Second textbox is just doing a postback no code.
Code is below
protected override void LoadViewState(object savedState)
{
base.LoadViewState(savedState);
}
protected void Page_Load(object sender, EventArgs e)
{ }
protected void Button1_Click(object sender, EventArgs e)
{
TextBox1.Text = "Hello";
}
protected void Button2_Click(object sender, EventArgs e)
{ }
I turned Enableviewstate of page to false;
I noticed that when i click the first button textbox value changes to "hello" and when i click the second textbox it is still retaining the value "hello". How is this possible without viewstate ..
Then i turned Enableviewstate to true. In both cases LoadViewState is never called, i tried a lot...Can u pls give me a sample example where LoadViewState would be called
|
|
|
|
|
Perhaps the text is stored in control state ? That's possible, I'm not that sure of what goes in there.
I'm about to go out, otherwise I'd whip up a sample for you. I recommend googling for LoadViewState.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
I did this & got this without much trouble.
Hope that helps.
|
|
|
|
|
Regarding difference between VIEWSTATE and CONTROLSTATE, one differnec which i am aware of is, VIEWSTATE can be handled, edited, accesed by programmer while CONTROLSTATE can not be accessed, edited or disabled directly but it is maintained by .NET framework.
VikasParth
|
|
|
|
|
in asp.net 2005 ImgeditLibCtl.dll is included for displaying image in active x control (kodak image control coming with image professional) i am unable to display the image pls kindly help me
sathish
|
|
|
|
|
Consider using a sensible subject in future. Odds are, your question in this forum, relates to ASP.NET.
Your first step is probably to tell us what *does* happen, does it blow up, does it do nothing ? I mean, if this is an active X control that is installed on the machine yuo're using, it should work, to know why it's not, we need to know more details than 'I am unable to display the image'
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I HAD ACTIVE X CONTROL I CHOOSED IN REFERENCE BUT IT NOT DISPLAYED IN TOOL BAR SO I AM UNABLE TO PLACE THE TOOL IN WEB FORM PLS BUT IT SHOW IN SOULTION EXPO. WHY I ANABLE TO PLACE TO CONTROL PLS KINDLY HELP ME
SATHISH
|
|
|
|
|
Shouting[^] won't make your question any easier to understand.
I'm gonna go out on a limb here and assume you can't see a particular control in your toolbox that you're expecting to see. Try right-clicking over the toolbox, selecting "Choose items...", browse to the library containing the control & opening.
That said, bear these two thoughts in mind:
1. Are you sure there is a control in that library that you can add to your toolbox?
2. You want to place this on a Web form - chances are the people accessing your web form won't have the ability to see this control on the client side so what exactly are you trying to gain?
|
|
|
|
|
hi all,
Now I am working on Asp.net 2003 .
My problm is, in some pages, the load event is not working.
Somtime it wrks very fine but in certain time surprisingly the load event is not triggered.
At the same time , this pblm not affected to the other forms too.
what should I do?
Now i solve this problm by creating a new webform and copy the old from contents to new page and continue my work..But this is a tedious process and time consuming one.I didnt think this is the exact way...
thanks in advance.
All I ever wanted is what others have.... CrazySanker
|
|
|
|
|
Are you overriding the event, hooking it up in your init, or just letting it associate automatically ? The only reason for it not to fire, is that it's not hooked up properly.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
can u tel me the soln'??
how I know the event is hooking up in Init()??
i didnt do anything.
Just write some Database operation function like list all the country name from database to a dropdown , add attribute for invoking some javascript to some buttons like...
All I ever wanted is what others have.... CrazySanker
|
|
|
|
|
Vipin dev wrote: can u tel me the soln'??
Not without seeing the code, I don't have magical powers.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
There is a problem in VS 2003, where it sometimes removes the code that hooks up the handler with the event.
Look at the autogenerated code in the code behind file, and see if hooks up the Load event. If not, copy the code (might need adjustment for page name) from a page where it's working.
---
single minded; short sighted; long gone;
|
|
|
|