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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. popupcalender sample

popupcalender sample

Scheduled Pinned Locked Moved ASP.NET
helpcsstools
2 Posts 2 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.
  • V Offline
    V Offline
    venkata saibabu
    wrote on last edited by
    #1

    this is my code: protected void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { this.TextBox1.Text = System.DateTime.Now.ToShortDateString(); this.pnlCalendar.Attributes.Add("style", "DISPLAY: none; POSITION: absolute"); } else { string id = Page.Request.Form["__EVENTTARGET"].Substring(0,Page.Request.Form["__EVENTTARGET"].IndexOf(":")); if (id != this.ID) { this.pnlCalendar.Attributes.Add("style","DISPLAY: none; POSITION: absolute"); } else { this.pnlCalendar.Attributes.Add("style","POSITION: absolute"); } } Page.RegisterClientScriptBlock("Script_Panel" + this.ID, " function On"+this.ID+"Click() { if("+this.ID+"_pnlCalendar.style.display == \"none\") "+this.ID+"_pnlCalendar.style.display = \"\"; else "+this.ID+"_pnlCalendar.style.display = \"none\"; } "); this.Button1.Attributes.Add("OnClick","On"+this.ID+"Click()"); } and for changing the date: protected void Calendar1_SelectionChanged(object sender, System.EventArgs e) { this.TextBox1.Text = Calendar1.SelectedDate.ToShortDateString(); this.pnlCalendar.Attributes.Add("style", "DISPLAY: none; POSITION: absolute"); } now iam getting the error as below :please can any one help me to run properly my code: Length cannot be less than zero. Parameter name: length error is generated at this lines: Source Error: Line 23: else Line 24: { Line 25: string id = Page.Request.Form["__EVENTTARGET"].Substring(0,Page.Request.Form["__EVENTTARGET"].IndexOf(":")); Line 26: if (id != this.ID) Line 27: {

    C 1 Reply Last reply
    0
    • V venkata saibabu

      this is my code: protected void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { this.TextBox1.Text = System.DateTime.Now.ToShortDateString(); this.pnlCalendar.Attributes.Add("style", "DISPLAY: none; POSITION: absolute"); } else { string id = Page.Request.Form["__EVENTTARGET"].Substring(0,Page.Request.Form["__EVENTTARGET"].IndexOf(":")); if (id != this.ID) { this.pnlCalendar.Attributes.Add("style","DISPLAY: none; POSITION: absolute"); } else { this.pnlCalendar.Attributes.Add("style","POSITION: absolute"); } } Page.RegisterClientScriptBlock("Script_Panel" + this.ID, " function On"+this.ID+"Click() { if("+this.ID+"_pnlCalendar.style.display == \"none\") "+this.ID+"_pnlCalendar.style.display = \"\"; else "+this.ID+"_pnlCalendar.style.display = \"none\"; } "); this.Button1.Attributes.Add("OnClick","On"+this.ID+"Click()"); } and for changing the date: protected void Calendar1_SelectionChanged(object sender, System.EventArgs e) { this.TextBox1.Text = Calendar1.SelectedDate.ToShortDateString(); this.pnlCalendar.Attributes.Add("style", "DISPLAY: none; POSITION: absolute"); } now iam getting the error as below :please can any one help me to run properly my code: Length cannot be less than zero. Parameter name: length error is generated at this lines: Source Error: Line 23: else Line 24: { Line 25: string id = Page.Request.Form["__EVENTTARGET"].Substring(0,Page.Request.Form["__EVENTTARGET"].IndexOf(":")); Line 26: if (id != this.ID) Line 27: {

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Well, it means what it says. The index of the : is -1. there's no colon in the string. This is bad code, never ask for something without first making sure it's there.

      Christian Graus Driven to the arms of OSX by Vista.

      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