By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,442 Members | 1,311 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,442 IT Pros & Developers. It's quick & easy.

Modal Popup Extender disappearing during validation

malav123
100+
P: 217
Hi,
I am using ajax toolkit's modal popup extender which contains few text boxes and two buttons on it... i want to put validation on some of text boxes but my problem is after displaying message like "please enter name" when i cliks on ok button the modal popup dissapears... means my next line never executes that is the focus on that particular textbox... so what is the problem ??? i m waiting for response....


thanking u in advance....


-malav.
Jun 3 '08 #1
Share this Question
Share on Google+
24 Replies


hsriat
Expert 100+
P: 1,654
Difficult to make a guess without having look at the code, at least for me.

You may provide some code which is creating problem.
Jun 3 '08 #2

malav123
100+
P: 217
Difficult to make a guess without having look at the code, at least for me.

You may provide some code which is creating problem.


Hi,
Which code you want to see...
Jun 3 '08 #3

hsriat
Expert 100+
P: 1,654
Hi,
Which code you want to see...
You have to figure that out with some debugger.
What does firebug tell about the problem, or some other debugger...?
Jun 3 '08 #4

acoder
Expert Mod 15k+
P: 16,027
malav123, you've posted a few questions here and there's always the same problem about which code to post. What the experts here want to see is client-side code (what you see in the browser), i.e. the generated JavaScript code and relevant HTML markup. If we need to see more code, we'll ask.
Jun 3 '08 #5

malav123
100+
P: 217
You have to figure that out with some debugger.
What does firebug tell about the problem, or some other debugger...?

Hi,
my problem is solved now in which i have asked help from u....
but there is still one problem that for date i have take calendar control... but whenever i clicks on the image i gets the calendar control on back side of modal popup... so what can i do ???
the html code of that table is given below,

Expand|Select|Wrap|Line Numbers
  1. <table border="0" cellpadding="1" cellspacing="3" class="formText" style="margin-left:15px">                           
  2.                             <tr>
  3.                                 <td>
  4.                                     <asp:Label ID="lblReqStartDt" runat="server" Text="*" CssClass="RequiredField" />
  5.                                     <asp:Label ID="lblStart" runat="server" Text ="Start" />
  6.                                 </td>
  7.                                 <td>
  8.                                     <asp:TextBox ID="txtStartDt" runat="server" />
  9.                                     <img id="imgStart" onclick="showCalendarControl(ctl00$ctl1$txtStartDt)" alt="" src="../../images/calendar.gif" />
  10.                                 </td>   
  11.                             </tr>
  12.                             <tr>
  13.                                 <td>
  14.                                     <asp:Label ID="lblReqEndDt" runat="server" Text="*" CssClass="RequiredField" />
  15.                                     <asp:Label ID="lblEnd" runat="server" Text="End" />
  16.                                 </td>
  17.                                 <td>
  18.                                     <asp:TextBox ID="txtEndDt" runat="server" />                                    
  19.                                     <img id="imgEnd" onclick="showCalendarControl(ctl00$ctl1$txtEndDt)" alt="" src="../../images/calendar.gif"  />
  20.                                 </td>
  21.                             </tr>                              
  22.                             <tr>
  23.                                 <td colspan="2">
  24.                                     <asp:Label id="lblnote" runat="server" Text="Note: An E-mail will also be send for notification" ForeColor="red" Font-Bold="true" />                                    
  25.                                 </td>
  26.                             </tr> 
  27.  
  28.                         </table>
  29.  
in above table i am using calendar control for two text boxes i.e. start date and for end date... so please give me solution....
Jun 3 '08 #6

hsriat
Expert 100+
P: 1,654
Hey malav123,
This is again an ASP code. As the moderator said, you need to show the client side HTML.

When your page opens in the browser, do right click and click on view source. That is the code which we need to see when there's a problem.

Server side script has nothing to do with this.
A good tip for you too, when you have to debug your JavaScript, don't search for the problem in the ASP code. Do view source of the code and see what's wrong with it.

As far as your problem is concerned, you need to give zIndex value to the calender larger then the popup's. Check the function which is called to show the calender onclick of that button.
Jun 3 '08 #7

malav123
100+
P: 217
Hey malav123,
This is again an ASP code. As the moderator said, you need to show the client side HTML.

When your page opens in the browser, do right click and click on view source. That is the code which we need to see when there's a problem.

Server side script has nothing to do with this.
A good tip for you too, when you have to debug your JavaScript, don't search for the problem in the ASP code. Do view source of the code and see what's wrong with it.

As far as your problem is concerned, you need to give zIndex value to the calender larger then the popup's. Check the function which is called to show the calender onclick of that button.



ok thanks here is that html code,

Expand|Select|Wrap|Line Numbers
  1. <table border="0" cellpadding="1" cellspacing="3" class="formText" style="margin-left:15px">                           
  2.                             <tr>
  3.                                 <td>
  4.                                     <span id="ctl00_ctl1_lblReqStartDt" class="RequiredField">*</span>
  5.                                     <span id="ctl00_ctl1_lblStart">Start</span>
  6.                                 </td>
  7.                                 <td>
  8.                                     <input name="ctl00$ctl1$txtStartDt" type="text" id="ctl00_ctl1_txtStartDt" />
  9.                                     <img id="imgStart" onclick="showCalendarControl(ctl00$ctl1$txtStartDt)" alt="" src="../../images/calendar.gif" />
  10.                                 </td>   
  11.                             </tr>
  12.                             <tr>
  13.                                 <td>
  14.                                     <span id="ctl00_ctl1_lblReqEndDt" class="RequiredField">*</span>
  15.                                     <span id="ctl00_ctl1_lblEnd">End</span>
  16.                                 </td>
  17.                                 <td>
  18.                                     <input name="ctl00$ctl1$txtEndDt" type="text" id="ctl00_ctl1_txtEndDt" />                                    
  19.                                     <img id="imgEnd" onclick="showCalendarControl(ctl00$ctl1$txtEndDt)" alt="" src="../../images/calendar.gif"  />
  20.                                 </td>
  21.                             </tr>                              
  22.                             <tr>
  23.                                 <td colspan="2">
  24.                                     <span id="ctl00_ctl1_lblnote" style="color:Red;font-weight:bold;">Note: An E-mail will also be send for notification</span>                                    
  25.                                 </td>
  26.                             </tr> 
  27.  
  28.                         </table>
  29.  
Jun 3 '08 #8

acoder
Expert Mod 15k+
P: 16,027
my problem is solved now in which i have asked help from u....
What was the solution for the first problem? If you post it, it may help someone with a similar problem.
but there is still one problem that for date i have take calendar control... but whenever i clicks on the image i gets the calendar control on back side of modal popup... so what can i do ?
Have you tried setting the z-index as suggested by hsriat? If that doesn't work, post the client-side (not .NET) code for the modal popup and the calendar. You don't need to post all of it (it might be a lot of code) - just the relevant parts.
Jun 4 '08 #9

malav123
100+
P: 217
What was the solution for the first problem? If you post it, it may help someone with a similar problem.
Have you tried setting the z-index as suggested by hsriat? If that doesn't work, post the client-side (not .NET) code for the modal popup and the calendar. You don't need to post all of it (it might be a lot of code) - just the relevant parts.

Hi,
The solution of my previous problem is that now i have take one more button as a common button, before i was having two buttons as a "Okcontrolid" and "Cancelcontrolid", and modal popup was dissappears when i was click on "Okcontrolid" button so i made that button hide and put common button at that place as visible, so when modal popup 's validation gets ok at that time i makes "Okcontrolid" Button as visible so task is over... validations are working now, textboxes gets focus now, data of event also stores now in database..... And sorry that i always gets confused about which code you are asking... but i will not make such mistake in future....
Jun 4 '08 #10

acoder
Expert Mod 15k+
P: 16,027
No problem, thanks for posting. Did you manage to solve the second problem?
Jun 4 '08 #11

malav123
100+
P: 217
No problem, thanks for posting. Did you manage to solve the second problem?
No i still not got solution of my second problem... what shoud i do with the zindex ??? means i have to give zindex size more then modal popup or what ???
Jun 4 '08 #12

acoder
Expert Mod 15k+
P: 16,027
Yes, give it a higher value in the CSS or using JavaScript with the style.zIndex property.
Jun 4 '08 #13

hsriat
Expert 100+
P: 1,654
No i still not got solution of my second problem... what shoud i do with the zindex ??? means i have to give zindex size more then modal popup or what ???
If there are two or more elements overlapping each other, then the element with higher zIndex is shown above the one having lower zIndex.

What you need to do is:
Find out which function is called to create the calender. The function might be creating the calendar stuff by DOM methods. So just in the end of that function, set the style.zIndex property of the div containing the calender as something say 200. Try that, and see if it works.
If there's some separate CSS for that particular div which contains the calender, then add z-index:200 to that.

Change the value from 200 to higher if it still won't work.
Jun 4 '08 #14

malav123
100+
P: 217
If there are two or more elements overlapping each other, then the element with higher zIndex is shown above the one having lower zIndex.

What you need to do is:
Find out which function is called to create the calender. The function might be creating the calendar stuff by DOM methods. So just in the end of that function, set the style.zIndex property of the div containing the calender as something say 200. Try that, and see if it works.
If there's some separate CSS for that particular div which contains the calender, then add z-index:200 to that.

Change the value from 200 to higher if it still won't work.

Hi,

thanks for the reply, i have tried what you have suggested me but still i am not getting css as working on my calendar controll.... i have tried z-index in css... so what is the problem now ?
Jun 5 '08 #15

hsriat
Expert 100+
P: 1,654
Hi,

thanks for the reply, i have tried what you have suggested me but still i am not getting css as working on my calendar controll.... i have tried z-index in css... so what is the problem now ?
Show the calender part of the JS and CSS.
Jun 6 '08 #16

malav123
100+
P: 217
Show the calender part of the JS and CSS.
Hi,
I am sending you CSS file that i am using for the Calender controll, js file is very long so if you will need it then i will send u that code also..

Expand|Select|Wrap|Line Numbers
  1. #CalendarControlIFrame {
  2.   display: none;
  3.   left: 0px;
  4.   position: absolute;
  5.   top: 0px;
  6.   height: 250px;
  7.   width: 250px;
  8.   z-index: 5000;
  9. }
  10.  
  11. #CalendarControl {
  12.   position:absolute;
  13.   background-color:#CED5F2;
  14.   margin:0;
  15.   padding:0;
  16.   display:none;
  17.   z-index: 5000;
  18. }
  19.  
  20. #CalendarControl table {
  21.   font-family: arial, verdana, helvetica, sans-serif;
  22.   font-size: 8pt;
  23.   border-left: 1px solid #336;
  24.   border-right: 1px solid #336;
  25. }
  26.  
  27. #CalendarControl th {
  28.   font-weight: normal;
  29. }
  30.  
  31. #CalendarControl th a {
  32.   font-weight: normal;
  33.   text-decoration: none;
  34.   color: #FFF;
  35.   padding: 1px;
  36. }
  37.  
  38. #CalendarControl td {
  39.   text-align: center;
  40. }
  41.  
  42. #CalendarControl .header {
  43.   background-color: #5E636F;
  44. }
  45.  
  46. #CalendarControl .weekday {
  47.   background-color: #FCEDDC;
  48.   color: #000;
  49. }
  50.  
  51. #CalendarControl .weekend {
  52.   background-color: #FFC;
  53.   color: #000;
  54. }
  55.  
  56. #CalendarControl .current {
  57.   border: 1px solid #339;
  58.   background-color: #336;
  59.   color: #FFF;
  60. }
  61.  
  62. #CalendarControl .weekday,
  63. #CalendarControl .weekend,
  64. #CalendarControl .current {
  65.   display: block;
  66.   text-decoration: none;
  67.   border: 1px solid #FFF;
  68.   padding: 1px;
  69.   width: 2em;
  70. }
  71.  
  72. #CalendarControl .weekday:hover,
  73. #CalendarControl .weekend:hover,
  74. #CalendarControl .current:hover {
  75.   color: #FFF;
  76.   background-color: #336;
  77.   border: 1px solid #999;
  78. }
  79.  
  80. #CalendarControl .previous {
  81.   text-align: left;
  82. }
  83.  
  84. #CalendarControl .next {
  85.   text-align: right;
  86. }
  87.  
  88. #CalendarControl .previous,
  89. #CalendarControl .next {
  90.   padding: 1px 3px 1px 3px;
  91.   font-size: 1.4em;
  92. }
  93.  
  94. #CalendarControl .previous a,
  95. #CalendarControl .next a {
  96.   color: #FFF;
  97.   text-decoration: none;
  98.   font-weight: bold;
  99. }
  100.  
  101. #CalendarControl .title {
  102.   text-align: center;
  103.   font-weight: bold;
  104.   color: #FFF;
  105. }
  106.  
  107. #CalendarControl .empty {
  108.   background-color: #CCC;
  109.   border: 1px solid #FFF;
  110. }
  111.  
  112.  
Jun 6 '08 #17

hsriat
Expert 100+
P: 1,654
Hi,
I am sending you CSS file that i am using for the Calender controll, js file is very long so if you will need it then i will send u that code also..
I couldn't find any error in the CSS part.
Just don't keep same z-index for 2 elements.

Tell me where did you get the calendar code from, I'll see it there.
Jun 6 '08 #18

malav123
100+
P: 217
I couldn't find any error in the CSS part.
Just don't keep same z-index for 2 elements.

Tell me where did you get the calendar code from, I'll see it there.
Hi,
i am not getting what are you saying... and sorry for late reply because we have offday in work on saturday and sunday...
Jun 9 '08 #19

acoder
Expert Mod 15k+
P: 16,027
Are you using .NET controls or a third-party JavaScript calendar script?

I see in your CSS that you have an iframe. Does the modal popup also use an iframe? If you can, post the client-side HTML code and relevant JavaScript here. If not, try to create a small test case which demonstrates the problem and post the code or a link here. Also test in more than one browser to see if the problem is restricted to one browser or not.
Jun 9 '08 #20

malav123
100+
P: 217
Are you using .NET controls or a third-party JavaScript calendar script?

I see in your CSS that you have an iframe. Does the modal popup also use an iframe? If you can, post the client-side HTML code and relevant JavaScript here. If not, try to create a small test case which demonstrates the problem and post the code or a link here. Also test in more than one browser to see if the problem is restricted to one browser or not.
Yes i am using third party calendar controll and it is working fine in all of my pages, i have used it at many places but it only creates problem with modal popup extender only...
Jun 11 '08 #21

acoder
Expert Mod 15k+
P: 16,027
Cut your code down to the bare minimum with only the calendar and modal popup. If you still have the problem, post the client-side code here.
Jun 11 '08 #22

hsriat
Expert 100+
P: 1,654
or just give a link where you find that third party calender.
Jun 11 '08 #23

P: 1
or just give a link where you find that third party calender.
Hi, I am new to this forum. I had similar problem.

Just to confirm that hsrisat was right. I located the div element that displays the calendar from my style sheet, then i include z-index to it with a value of 10000. Initial the calendar still appeared behinde the modal popup. So i ncreased the z-index to 500000. immediately, the calendar appeared at the top of the modal popup. That solved my problem.

This is my style sheet amendment

div.calendar { position: relative; z-index:500000;}

Thanks
Jun 26 '08 #24

acoder
Expert Mod 15k+
P: 16,027
Welcome to Bytes and thanks for sharing. It does seem too much of a fix to have such a high number for a z-index. Perhaps you should check the z-index of the modal popup too.
Jun 26 '08 #25

Post your reply

Sign in to post your reply or Sign up for a free account.