CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

MS SQL 2008 on ASP.NET Hosting



Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.web_forms Tags:
Item Type: NewsGroup Date Entered: 6/5/2008 12:26:16 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 5 Views: 0 Favorited: 0 Favorite
6 Items, 1 Pages 1 |< << Go >> >|
tinomclaren
Asp.Net User
Test text box for contents before modal pops up6/5/2008 12:26:16 AM

0/0

Hi all

How can i test a text box to see if its not empty before poping up a Modal Popup Extender?

i.e. I dont want the Modal popup to display unless there is some text in the text box

The form has a button to bring up the modalpopup, the aspx is below

<asp:Button ID="add_picture_btn" runat="server" Text="Add Picture" onclick="add_picture_btn_Click" /> 

<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="add_picture_btn" PopupControlID="Panel1" BackgroundCssClass="modal_BG" OkControlID="Ok_btn" CancelControlID="Cancel_btn" ></cc1:ModalPopupExtender>

I would also like to display an alert box telling the user to enter something in the textbox first before clicking the button 

any code examples would be appreciated

 

Regards

Tino


Never argue with an idiot strangers cant tell the difference....
mellamokb
Asp.Net User
Re: Test text box for contents before modal pops up6/5/2008 3:48:42 AM

0/0

Hi,

Try using a RequiredFieldValidator on the TextBox:

        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
            ControlToValidate="YOUR_TEXTBOX_CONTROL_ID" EnableClientScript="true"
            ErrorMessage="Please enter something in the textbox first!"></asp:RequiredFieldValidator>
  

Regards,

~ mellamokb

tinomclaren
Asp.Net User
Re: Test text box for contents before modal pops up6/5/2008 1:23:21 PM

0/0

Thanks for the reply

I have a validator on the text box but it stil allows the modal popup to fire.

What i didn't mention was the text box is in a formview control.

Im not up to scratch with Javascript yet but it looks like javascript will solve it,

Im getting confused as to how javascript will work with a server control though ( so im trying to learn that too now!!!! - brain overload)

Any suggestions appreciated

Regards

Tino 


Never argue with an idiot strangers cant tell the difference....
Hong-Gang Chen
Asp.Net User
Re: Test text box for contents before modal pops up6/9/2008 6:35:50 PM

0/0

tinomclaren:

Hi all

How can i test a text box to see if its not empty before poping up a Modal Popup Extender?

i.e. I dont want the Modal popup to display unless there is some text in the text box

The form has a button to bring up the modalpopup, the aspx is below

<asp:Button ID="add_picture_btn" runat="server" Text="Add Picture" onclick="add_picture_btn_Click" /> 

<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="add_picture_btn" PopupControlID="Panel1" BackgroundCssClass="modal_BG" OkControlID="Ok_btn" CancelControlID="Cancel_btn" ></cc1:ModalPopupExtender>

I would also like to display an alert box telling the user to enter something in the textbox first before clicking the button 

any code examples would be appreciated

 

Hi Tino,

Base on my experience, I think that you can use registerstartupscript to solve your problem.

Hope it helps,

Hong Gang 


 

 


Sincerely,
Ocean
Microsoft Online Community Support
Please remember to click ?Mark as Answer? on the post that helps you, and to click ?Unmark as
Answer? if a marked post does not actually answer your question.
sreenathp143
Asp.Net User
Re: Test text box for contents before modal pops up6/9/2008 6:47:11 PM

0/0

first disable the modalpopupextender.

 

then in the on click event for button

if (textbox.text=="")

{response.write("please enter value in textbox");

}

else {modalpopupextender.enabled=true;}

tinomclaren
Asp.Net User
Re: Test text box for contents before modal pops up6/9/2008 8:15:42 PM

0/0

Thank you Hong

I didn't resolve this issue, I actually decided not to use the modal popup as Im spending a lot of time trying to resolve the issue, im Learing Javascript but dont have enought time to use it with this project.

Thanks for the suggestion, I will follow it up, if I resolve it them i will post here.

Regards

Tino


Never argue with an idiot strangers cant tell the difference....
6 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Teach Yourself Java in 21 Days: Professional Reference Edition Authors: Laura Lemay, Charles L. Perkins, Michael Morrison, Pages: 1247, Published: 1996
The Definitive DataWindow: Your Key to PowerBuilder Success Authors: Richard Brooks, Pages: 800, Published: 2000
Medinfo 2007: Proceedings of the 12th World Congress on Health (medical) Informatics : Building Sustainable Health Systems Authors: Klaus A. Kuhn, James R. Warren, Tze-Yun Leong, Pages: 1499, Published: 2007
SVG Unleashed Authors: Andrew Watt, Chris Lilley, Pages: 1117, Published: 2002

Web:
InformIT: Building Modal Dialogs into Your Web Application ... Toggle Open Article Table of Contents Article Contents ... Although you can find a large number of JavaScript modal dialog box implementations ... The function that displays the modal dialog box has to return to the caller before the user supplies the ... prompt: Text to be displayed in the body of the dialog box. ...
pop-up-modal-dialog A call to pop-up-modal-dialog will return only in these cases: ... margin widget -height)) (button-width 60) (dialog (make-window :modal-dialog-test :class ' dialog :title "Enter Two Strings" :pop-up t :interior (make-box-relative 100 200 width height) :dialog-items (list (make-instance 'editable-text :name :string1 ...
Fire Modal Popup Conditonally - ASP.NET Forums This would have to be done before the TargetControl is accessed. ... before 1st postback (I have autopostback set on the textbox), but if I click cancel from the modal pop up and as ... I'll further test it. Appreciated. ...
Eric Martin » SimpleModal [if lt IE 7]>