Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Calender Pop Up and master Page Problem

Calender Pop Up and master Page Problem

Scheduled Pinned Locked Moved ASP.NET
csharpjavascriptvisual-studiohelpquestion
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kidus1
    wrote on last edited by
    #1

    am using visual studio 2005 and I am trying to create a popup calender so when a user click on a image on the main form, a calender will then popup, the user will select a date and the date will then be passed back to the main form and populate a textbox. it works fine. but when i used master page for all my pages and i put the textbox inside the content , the calender pops up but when i select the date nothing happens .. the textbox was not populated with the selected date from the calender and the window was not closed. Here is my code Default Page/Parent Window/ function GetDate(CtrlName) { ChildWindow = window.open('Calendar.aspx?FormName=' + document.forms[0].name + '&CtrlName=' + CtrlName, "PopUpCalendar", "width=270,height=300,top=200,left=200,toolbars=no,scrollbars=no,status=no,resizable=no"); } [Start Date](javascript:GetDate('txtStartDate'))
    Code for the Calendar Page/Child Page/ function ReturnDate() { window.opener.document.forms["<%= strFormName %>"].elements["<%=strCtrlName %>"].value = "<%= strSelectedDate %>"; window.close(); } function Close() { window.close(); } Public strFormName As String Public strCtrlName As String Public strSelectedDate As String Sub Page_Load(Sender As Object, E As EventArgs) If Not IsPostBack Then myCalendar.SelectedDate = System.DateTime.Now() End If strSelectedDate = myCalendar.SelectedDate.ToString("dd/MM/yyyy") strFormName = Request.QueryString("FormName") strCtrlName = Request.QueryString("CtrlName") End Sub Sub myCalendar_SelectionChanged(sender As Object, e As EventArgs) strSelectedDate = myCalendar.SelectedDate.ToString("dd/MM/yyyy") End Sub

    K 1 Reply Last reply
    0
    • K kidus1

      am using visual studio 2005 and I am trying to create a popup calender so when a user click on a image on the main form, a calender will then popup, the user will select a date and the date will then be passed back to the main form and populate a textbox. it works fine. but when i used master page for all my pages and i put the textbox inside the content , the calender pops up but when i select the date nothing happens .. the textbox was not populated with the selected date from the calender and the window was not closed. Here is my code Default Page/Parent Window/ function GetDate(CtrlName) { ChildWindow = window.open('Calendar.aspx?FormName=' + document.forms[0].name + '&CtrlName=' + CtrlName, "PopUpCalendar", "width=270,height=300,top=200,left=200,toolbars=no,scrollbars=no,status=no,resizable=no"); } [Start Date](javascript:GetDate('txtStartDate'))
      Code for the Calendar Page/Child Page/ function ReturnDate() { window.opener.document.forms["<%= strFormName %>"].elements["<%=strCtrlName %>"].value = "<%= strSelectedDate %>"; window.close(); } function Close() { window.close(); } Public strFormName As String Public strCtrlName As String Public strSelectedDate As String Sub Page_Load(Sender As Object, E As EventArgs) If Not IsPostBack Then myCalendar.SelectedDate = System.DateTime.Now() End If strSelectedDate = myCalendar.SelectedDate.ToString("dd/MM/yyyy") strFormName = Request.QueryString("FormName") strCtrlName = Request.QueryString("CtrlName") End Sub Sub myCalendar_SelectionChanged(sender As Object, e As EventArgs) strSelectedDate = myCalendar.SelectedDate.ToString("dd/MM/yyyy") End Sub

      K Offline
      K Offline
      kjosh
      wrote on last edited by
      #2

      Hi, I am also suffered with that problem. The problem is when you put the controls inside master page: other container controls that the runtime engine seems to change the names of the controls and adds the '$' Character to them. You might want to view the rendered HTML source sent to the browser. And change your code according to those control name changes in masterpage. Hope this helps.

      K 1 Reply Last reply
      0
      • K kjosh

        Hi, I am also suffered with that problem. The problem is when you put the controls inside master page: other container controls that the runtime engine seems to change the names of the controls and adds the '$' Character to them. You might want to view the rendered HTML source sent to the browser. And change your code according to those control name changes in masterpage. Hope this helps.

        K Offline
        K Offline
        kidus1
        wrote on last edited by
        #3

        I add to the name of the controls $ but there is no difference.Make it clear pls help kidus

        K 1 Reply Last reply
        0
        • K kidus1

          I add to the name of the controls $ but there is no difference.Make it clear pls help kidus

          K Offline
          K Offline
          kidus1
          wrote on last edited by
          #4

          And I put the controls inside the Asp:Content not Master page.

          K 1 Reply Last reply
          0
          • K kidus1

            And I put the controls inside the Asp:Content not Master page.

            K Offline
            K Offline
            kjosh
            wrote on last edited by
            #5

            Hi, In master page you can find the content place holder window.open('popup.aspx?textbox=ctl00_Body_Wizard1_txtBoxElectionDate1' here ctl00_Body_txtBoxElectionDate1 is the my text box name which i got be seeing the view source. use that name here. And In popup.aspx I used like this: String strScript = "window.opener.document.forms['aspnetForm']." + control.Value + ".value = '"; strScript += calDate.SelectedDate.ToString("MM/dd/yyyy"); strScript += "';self.close()"; strScript += "</" + "script>"; RegisterClientScriptBlock("anything", strScript); aspnetForm is the the form name which contain the textbox to put the selected date. Check your code. Hope this helps. </x-turndown>

            K 1 Reply Last reply
            0
            • K kjosh

              Hi, In master page you can find the content place holder window.open('popup.aspx?textbox=ctl00_Body_Wizard1_txtBoxElectionDate1' here ctl00_Body_txtBoxElectionDate1 is the my text box name which i got be seeing the view source. use that name here. And In popup.aspx I used like this: String strScript = "window.opener.document.forms['aspnetForm']." + control.Value + ".value = '"; strScript += calDate.SelectedDate.ToString("MM/dd/yyyy"); strScript += "';self.close()"; strScript += "</" + "script>"; RegisterClientScriptBlock("anything", strScript); aspnetForm is the the form name which contain the textbox to put the selected date. Check your code. Hope this helps. </x-turndown>

              K Offline
              K Offline
              kidus1
              wrote on last edited by
              #6

              hi Thank you for your fast response in the code String strScript = "window.opener.document.forms['aspnetForm']." + control.Value + ".value = '"; the form name 'aspnetForm'.There is only one form in the master page.No other forms in the other pages.My text box is in the other pages. Any help kidus</x-turndown>

              U 1 Reply Last reply
              0
              • K kidus1

                hi Thank you for your fast response in the code String strScript = "window.opener.document.forms['aspnetForm']." + control.Value + ".value = '"; the form name 'aspnetForm'.There is only one form in the master page.No other forms in the other pages.My text box is in the other pages. Any help kidus</x-turndown>

                U Offline
                U Offline
                User 1860821
                wrote on last edited by
                #7

                you have to modifiy like this onclick ="javascript:GetDate('ctl00$ContentPlaceHolder1$"Text box name here"')"

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups