|
I am having UserControl1.ascx and WebForm1.aspx Files in my project. I have included Usercontrol1.ascx in WebForm1.aspx page. UserControl1.ascx contains Login Info (user name, password and login sumit button) and the fields are validated with requiredfield validator. webform1.aspx contains registration details and submit button. here also the fields are validated with requiredfield validator. now, if i press the login button of usercontrol1.ascx the registration fields are getting validated and also if i press registration form submit button the login fields are getting validated. what i want is the login submit should validate only (username and password) and registration submit button should validate only the registration form fields. how do i resolve this problem. pls. help me out...
|
|
|
|
|
Hi,
Make both the validator enable = false on webform page load event write the following code.
//declare instance for required field validator
RequiredFieldValidator rv1 = new RequiredFieldValidator();
//declare instance for usercontrol
System.Web.UI.UserControl wui = new UserControl();
//find the usercontrol
wui = (System.Web.UI.UserControl)(this.FindControl("WebUserControl11"));
//find the requiredfield validator (which is in usercontrol)
rv1 = (System.Web.UI.WebControls.RequiredFieldValidator)(wui.FindControl("RequiredFieldValidator1")); //searching usercontrol requiredfield validator
button click event (this is in webform) write the following code
req1.Enabled = true;// this requiredfield validator is in your webform
RequiredFieldValidator r1 = new RequiredFieldValidator();
System.Web.UI.UserControl wui = new UserControl();
wui = (System.Web.UI.UserControl)(this.FindControl("WebUserControl11"));
r1 = (System.Web.UI.WebControls.RequiredFieldValidator)(wui.FindControl("RequiredFieldValidator1"));
req1.Validate();
if (IsValid)
{
r1.Enabled = false;
--statement--
}
************* user control **************
usercontrol page load event write the following code
RequiredFieldValidator reqq1 = new RequiredFieldValidator();
reqq1 = (System.Web.UI.WebControls.RequiredFieldValidator)(Page.FindControl("req1"));
reqq1.Enabled = false;
RequiredFieldValidator1.Enabled = false;
reqq1.EnableClientScript = false;
RequiredFieldValidator1.EnableClientScript = false;
usercontrol button click event write the following code
RequiredFieldValidator1.Enabled = true;
RequiredFieldValidator reqq1 = new RequiredFieldValidator();
reqq1 = (System.Web.UI.WebControls.RequiredFieldValidator)(Page.FindControl("req1"));// searching webpage requiredfield validator
RequiredFieldValidator1.Validate();
if(RequiredFieldValidator1.IsValid)
{
reqq1.Enabled = false;
--statement--
}
Thanks
Warm Regards
Prakash-B
|
|
|
|
|
hello
i want to create new SmartDeviceApplication .
the Emulator apper but my form dose not.
Pleeeeeeeeeease help me soon as you can
Ramiforu2002@hotmail.com
Ramiforu2002@yahoo.com
Rami Alkhalyleh
Rami Alkhalyleh
|
|
|
|
|
could anybody teach me how to implement the code about auto detect web drive's status of connect/disconnect and also connect/disconnect function ? thanks very much !
|
|
|
|
|
R2409 wrote: web drive's
What's a "web drive"?
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
sorry , I just mean the network drive being shared by network form other computer ! (ps . or it should named as mapped drive )
|
|
|
|
|
Hey,
do anyone know of any good basic articles about designing / creating a GUI in Visual Studio 2005 ?
What i am wondering is the basic techniques for switching content and stuff like that depending on what you choose in a menu (etc.).
I dont really get if you create a Panel and throw all your stuff for one MenuItem on it, and then when you choose in the menu, you just simply switch the panels ?
Or how is it done ?
Hope someone can help
Martin
|
|
|
|
|
|
Is there a way to disable the [x]that closes the form (upper-right corner)?
|
|
|
|
|
add
this.ControlBox= false;
in the InitializeComponent() function or u can directly disable this in the windows style property of the form
sathy
|
|
|
|
|
I'm trying to access my forms (Form1) child objects, such as panels, sliderbars, toolbars, etc from a second class that i've added to the project.
Currently i'm accessing Form1 via Form1.ActiveForm the problem that i'm having is that i can access the standard stuff from the form class, but nothing else, is this because Form1 is a public class, and all the child objects are private?
if this is the case is it safe for me to change only the objects that i need to access to public, or is that unsafe coding?
Is there a better way?
or am i just going about this all wrong?
|
|
|
|
|
Is it safe? Yeah.
Is it proper coding practice? No way!
Your second class shouldn't know anything about the form that called it. Your Form should be passing the data it needs to to the class methods and processing any return data required. Your second class should not be trying to modify the form, or read from it, at all.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
JstDaNuGuy wrote: if this is the case is it safe for me to change only the objects that i need to access to public, or is that unsafe coding?
You should not make any field in a class public. See this article on Why make fields in a class private, why not make them public?[^]
JstDaNuGuy wrote: Is there a better way?
Yes. But it depends on what you are trying to do. What is the purpose of the second class? And what is the reason for the interaction?
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
thanks for the information guys...
what im' trying to do is set the form state upon load then save on exit. but i have much more to set/save than just the form size, and i was just trying to do it from a different class
i'm still learning...
|
|
|
|
|
i want to run a file past to my function with the default program reader, that is:
if the file passed is a .xls run that file in Microsoft Excel,
if it is a .gif run the file in the Windows Image Preview
if it is an .html run the file with Explorer, and so on...
|
|
|
|
|
Simple. Just launch the file using the Process[^] class, just like launching any .EXE. Make sure you set the ProcessStartInfo.UseShellExecute property to true. This will make it launch just like you double-clicked it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Anyone know if any links or where I get a COM for it?
I need to read the bulkmail folder.
Any Ideas, other than peeking at windows all day.
Nick
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
Outlook Express doesn't expose a COM model.
It does, however, make heavy use of the Messaging API[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I just wanted to read the bulk mail.
I can create my own, but then I would have to add all the additonal support for news and junk. Which I dont want to do.
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
So just code reading the mail! Where did you get this "You MUST implement a news reader." junk?
Outlook Express uses the MAPI API to download mail from a server. If that's all you want to do, then you just use the MAPI API to do it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yeah, but since hotmail and others are a POP server then it pops off.
Using MAPI, can I just peek at the message? Rather than taking it. I don't want this to become a mail application, or at least not right now.
Nick
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
MAPI is not a way around the features of a POP3 or SMTP server, it is an interface to use those servers. If the server does not support "peeking" at a message, then you can't peek at it.
Most server, though, will let you download a message AND leave it on the server. You just have to check with the POP3 spec to see what the standard commands are and see if MAPI will support them.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ok, I wasn't sure.
I didnt want to actually take them away, then I would need all kinds of functionality. I just want to scan the messages for spammers And report them.
Thank you for helping.
Thanks,
Nick
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
in design mode i've set a textbox PasswordChar to *
During the running i want to go back the password textbox to normal, so to let see all the characters.
How can i do?
|
|
|
|
|
this.textBox1.PasswordChar = char.MinValue;
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|