CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 2/5/2008 6:59:17 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 6 Views: 34 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
7 Items, 1 Pages 1 |< << Go >> >|
sunny74
Asp.Net User
problem displaying popup calendar in contentpage2/5/2008 6:59:17 AM

0/0

Dear All,

I am having a masterpage and several contentpages that use this masterpage.

I need to display a javascript popup calendar and gets its value into a textbox in one of the content pages.

The problem is that a content page cannot have the <head> tags and therefore cannot mention the js file, css in it.

It can however have the <script> section and I tried to use it but it doesn't work.

I am calling the js file on the click event of a Imagebutton as below:

<table width="100%" height="0">

<tr>

<td style="width: 91px; height: 10px;" align="right">

<asp:Literal ID="Literal1" runat="server" Text="From Date"></asp:Literal></td>

<td style="width: 84px; height: 10px;" align="right" valign="middle">

<input id="useDateCal_txt_Date" style="WIDTH: 80px; HEIGHT: 14px" type="text" size="9" name="useDateCal:txt_Date2" runat="server" >

</td>

<td align="left" style="width: 9px; height: 10px" valign="middle">

<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl ="Calendar_component/calendar.gif" width="30" border="0" style="height: 16px" OnClick="ImageButton1_Click"/></td>

Then I did the following:

I registered the script file in the Click event handler of the Imagebutton as below:

protected void ImageButton1_Click(object sender, ImageClickEventArgs e)

{

string scriptUrl = "~/ClinicalSection/Calendar_component/Calendar.js";

this.Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "Mykey", scriptUrl);

}

Then I am calling the main function of the js file by adding attributes in the Page_load event as below:

protected void Page_Load(object sender, EventArgs e)

{

//getddllist();

//ImageButton1.Attributes.Add("onclick", "calopen");

string calendarJS = String.Format("showCalendarControl('{0}')", useDateCal_txt_Date);ImageButton1.Attributes.Add("onclick", calendarJS);

}

But it doesn't work.What is the problem?

Your help will be highly appreciated.

Thanks.

orzeh
Asp.Net User
Re: problem displaying popup calendar in contentpage2/5/2008 9:22:39 AM

0/0

hi!

register the script not in image Click event but in Page_Load.

should work.

 

orzeh 


code less, think more!
sunny74
Asp.Net User
Re: problem displaying popup calendar in contentpage2/5/2008 9:59:17 AM

0/0

 

Hi,

I put the code from the ImageButton click event into the Page_Load event and put the entire thing

within If(!IsPostback) {   }  block. But still it doesn't work.

Thanks. 

 

orzeh
Asp.Net User
Re: problem displaying popup calendar in contentpage2/5/2008 10:58:24 AM

0/0

 hi!

include this script every time page loads.

try this:


protected void Page_Load(object sender, EventArgs e)

{

string calendarJS = String.Format("showCalendarControl('{0}')", useDateCal_txt_Date);ImageButton1.Attributes.Add("onclick", calendarJS);

string scriptUrl = "~/ClinicalSection/Calendar_component/Calendar.js";

this.Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "Mykey", scriptUrl);

  }

 

what JS error do you receive?

 

orzeh 

 


code less, think more!
sunny74
Asp.Net User
Re: problem displaying popup calendar in contentpage2/5/2008 6:48:29 PM

0/0

Hi,

I don't get any error.That is in fact the main.If I got error I would atleast know where to make changes.

Nothing happens except a Postback. Pls try it out yourself and if you succeed let me know.

 

Thanks

salim_amin
Asp.Net User
Re: problem displaying popup calendar in contentpage2/5/2008 8:56:30 PM

0/0

use HTML image control. Why do you want to do post back?


-------------------------------------------------
Please: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.
salim_amin
Asp.Net User
Re: problem displaying popup calendar in contentpage2/5/2008 9:01:00 PM

0/0

i guess i have understood your questin properly. here is the code for that.

 

<%@ Page Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="contentPageCal.WebForm1" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

<script language="javascript" type="text/javascript">

function ShowCal()

{

alert(
'open a popup form where your calander controls is')

}

</script>

<table width="100%" height="0">

<tr>

<td style="width: 91px; height: 10px;" align="right">

<asp:Literal ID="Literal1" runat="server" Text="From Date"></asp:Literal>

<input id="useDateCal_txt_Date" style="WIDTH: 80px; HEIGHT: 14px" type="text" size="9" name="useDateCal:txt_Date2" runat="server" />

&nbsp;

<img src="imapgepath" onclick="ShowCal()"/>

&nbsp;&nbsp;

</td>

<td style="width: 84px; height: 10px;" align="right" valign="middle">

&nbsp;</td>

<td align="left" style="width: 9px; height: 10px" valign="middle">

</td>

</tr>

</table>

</asp:Content>


-------------------------------------------------
Please: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.
7 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
problem displaying popup calendar in contentpage - ASP.NET Forums problem displaying popup calendar in contentpage. Last post 02-05-2008 4:01 PM by salim_amin. 6 replies. Sort Posts: ...
popup calendar in content page in asp.net 2.0 - ASP.NET Forums How to pop up calendar in asp.net 2.0 in content page. ... Hi anyone help me to solve the problem.. Regards. karthikeyan. HI Happy Smiling Regards ...
PopUp Calendar: ASP Alliance I WANT TO ADD POPUP CALENDAR FOR MY FORM TO DISPLAY YEARS OF EXPERIENCE. ... When using the Calendar Popup in a content page of a masterpage the strForName ...
MSDN how to call a javascript function from content page which was ... I had overcome with the same problem adding the Calendar to a content page... So i added that javascript within the page_prerender() event and it works fine ...
Populate Calender From Content Page Using Master Page in asp.net ... Jan 11, 2008 ... When using the Calendar Popup in a content page of a masterpage the ... How can I fix this and display the date into textbox after selecting ...
Dynamically create a PopupCalendar instance - ng.asp-net-forum ... NET MVC Tip #36 – Create a Popup Calendar Helper ... Can't reference dynamically added control from content page - ASP.NET ... ... get "Object Reference not ...
How can i call .js file in content page in asp.net How can i call .js file in content page.i have one textbox and img is when i click on img it display popup calendar calling form dt.js file. ...
How to reference and populate controls on Content Page I basically need to populate txtEndDate on the content page. if (!this.Page. .... The popup Calendar page does not use masterpage. ...
Tigra Calendar Product Family - The calendar isn't working since I ... The calendar isn't working since I implemented it within a Content Page which ... Problem with Lighbox on a Dynamic AJAX Content Page - Dynamic ... Problem with Lighbox on a Dynamic AJAX Content Page Dynamic Drive ... what I'm trying to achieve though is a pop-up page that can hold ...




Search This Site:










dnn 2.x multiple module definitions don't show up

vertical tabstrip

late binding disallowed, so how do i get at it?

implementing rsacryptoserviceprovider *and* javascript

error about to pull plug on my dnn portal

new site built on dnn based on the original ibuyspy potal!

curious why there is a portal skin and admin skin

does dnn works with community server?

help with ticket / sched. tasks

signing data with your private exchange key

framework version 2.0 or 1.1?

object+reference error

parent menu (horizontal) and child menu (vertical) how to have parent show selcted when a child option is being displayed.

resizing the div (division) holding a gridview

common masterpage on every application on server

login control second button issue

control in frame problem

adding tabs using codebehind information from a database

connected webparts question

how to make content pane(left,right...) as equal width

problems deploying to hosted server

skinning problem

change password after login for first time - how to set it up?

unexpected behavior when using impersonation code

the virtual path '/desktopmodules/something/somethign.ascx' maps to another application, which is not allowed.

form controls in text/html module...

multiple photo uploads

resource issue

remote hosting security

dnn error:

 
All Times Are GMT