Click here to Skip to main content
15,906,097 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionAdding { and } to format string Pin
Ali Al Omairi(Abu AlHassan)9-Apr-11 0:30
professionalAli Al Omairi(Abu AlHassan)9-Apr-11 0:30 
AnswerRe: Adding { and } to format string Pin
Wendelius9-Apr-11 1:26
mentorWendelius9-Apr-11 1:26 
GeneralRe: Adding { and } to format string Pin
Ali Al Omairi(Abu AlHassan)9-Apr-11 1:57
professionalAli Al Omairi(Abu AlHassan)9-Apr-11 1:57 
GeneralRe: Adding { and } to format string Pin
Wendelius9-Apr-11 1:59
mentorWendelius9-Apr-11 1:59 
GeneralRe: Adding { and } to format string Pin
Ali Al Omairi(Abu AlHassan)17-Apr-11 20:47
professionalAli Al Omairi(Abu AlHassan)17-Apr-11 20:47 
Questionnested gridview not sorting data Pin
gavindon8-Apr-11 9:20
gavindon8-Apr-11 9:20 
QuestionHow can i see html code in outlook 2010? Pin
buffering837-Apr-11 23:28
buffering837-Apr-11 23:28 
QuestionTextBox value doesnot update if Calender control placed below the textbox control [modified] Pin
schampacc7-Apr-11 22:13
schampacc7-Apr-11 22:13 
In the calnder control when I click on the last selected value for the 2nd time the value should be removed from the textbox. right now the value is not getting removed from the textbox.
Also when I click on calnder control for 2nd time, in the codebehind where I set the textbox value I can see the updated value been set to Textbox in the SelectedDates() event but that value is not reflected on the webpage.




This code for making Calender to work as multiple select. EX: select 3 values from the calender controls all those values will be displayed in the textbox, when u click on calender control and if the value already exits the value gets removed from the textbox.

Now the calender has 3 values and the default select on the calnder is the 3rd value. If the user clicks on the 3rd value again on the calnder control the value from the textbox is not removed whereas if clicks on one of the previos 2 values in the calender control that value gets removed and then if he clicks the 3rd value now it gets removed.

Whereas if we put the Calender control above textbox control and textbox has 3 values and now if u select 3rd value in the calnder, the value gets removed from the textbox.

Concern: How to remove the last selected value from the textbox when calnder control is placed below the textbox.

ASPX CODE:

-------------------------------------------------------------------------------------

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"> 
    <title></title> 
</head> 
<body> 
    <form id="form1" runat="server"> 
    <div> 
         
        
        
        <asp:TextBox ID="TextBox1" runat="server" Width="427px"  
            /> 
        <asp:Calendar ID="Calendar1" runat="server" ondayrender="Calendar1_DayRender"  
            onselectionchanged="Calendar1_SelectionChanged"></asp:Calendar> 
        
          
    </div> 
    </form> 
</body> 
</html>

using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
 
namespace WebApplication1 
{ 
    public partial class WebForm1 : System.Web.UI.Page 
    { 
        public static List<DateTime> list = new List<DateTime>(); 
 
        private bool calenderStatus = false; 
 
        public bool CalenderStatus 
        { 
            get { return calenderStatus; } 
            set { calenderStatus = value; } 
        }      
 
        protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) 
        {             
            if (e.Day.IsSelected == true) 
            {                
                if (CalenderStatus == false) 
                    SelectedDates();                
            }            
              
        } 
 
        protected void Calendar1_SelectionChanged(object sender, EventArgs e) 
        { 
            SelectedDates(); 
        } 
 
        private void SelectedDates() 
        { 
            CalenderStatus = true; 
            for (int i = 0; i < Calendar1.SelectedDates.Count; i++) 
            { 
                if (TextBox1.Text == "") 
                    TextBox1.Text = Calendar1.SelectedDates[i].ToShortDateString(); 
                else 
                { 
                    if (TextBox1.Text.Contains(Calendar1.SelectedDates[i].ToShortDateString())) 
                    { 
                        TextBox1.Text = TextBox1.Text.Replace("," + Calendar1.SelectedDates[i].ToShortDateString(), ""); 
                        TextBox1.Text = TextBox1.Text.Replace(Calendar1.SelectedDates[i].ToShortDateString() + ",", ""); 
                    } 
                    else 
                        TextBox1.Text = TextBox1.Text + "," + Calendar1.SelectedDates[i].ToShortDateString(); 
                } 
            } 
        }        
 
 
 
    } 
}


modified on Friday, April 8, 2011 4:22 AM

QuestionAJAX Accordion Control Pin
Orcun Iyigun7-Apr-11 14:52
Orcun Iyigun7-Apr-11 14:52 
AnswerRe: AJAX Accordion Control Pin
Pete O'Hanlon7-Apr-11 23:11
mvePete O'Hanlon7-Apr-11 23:11 
GeneralRe: AJAX Accordion Control Pin
Orcun Iyigun8-Apr-11 7:13
Orcun Iyigun8-Apr-11 7:13 
QuestionURL redirection Pin
Member 78129457-Apr-11 1:04
Member 78129457-Apr-11 1:04 
AnswerRe: URL redirection Pin
Viral Upadhyay7-Apr-11 2:03
Viral Upadhyay7-Apr-11 2:03 
Questionjavascript function call using ScriptManager.RegisterStartupScript Pin
anishkannan6-Apr-11 23:41
anishkannan6-Apr-11 23:41 
AnswerRe: javascript function call using ScriptManager.RegisterStartupScript Pin
Arindam Tewary7-Apr-11 1:42
professionalArindam Tewary7-Apr-11 1:42 
QuestionWhere is System.Web.Extensions, Version=3.6.0.0 ? Pin
mrquang936-Apr-11 22:23
mrquang936-Apr-11 22:23 
AnswerRe: Where is System.Web.Extensions, Version=3.6.0.0 ? Pin
Parwej Ahamad7-Apr-11 2:45
professionalParwej Ahamad7-Apr-11 2:45 
GeneralRe: Where is System.Web.Extensions, Version=3.6.0.0 ? Pin
mrquang937-Apr-11 16:02
mrquang937-Apr-11 16:02 
Questionon Autocomplete, call ashx page to get data Pin
Ravi Sant6-Apr-11 19:34
Ravi Sant6-Apr-11 19:34 
AnswerRe: on Autocomplete, call ashx page to get data Pin
ktrrzn6-Apr-11 21:12
ktrrzn6-Apr-11 21:12 
QuestionMoveNext is not moving next!! Pin
Bomb_shell6-Apr-11 10:57
Bomb_shell6-Apr-11 10:57 
AnswerRe: MoveNext is not moving next!! Pin
Luc Pattyn6-Apr-11 13:57
sitebuilderLuc Pattyn6-Apr-11 13:57 
AnswerRe: MoveNext is not moving next!! Pin
ktrrzn6-Apr-11 13:58
ktrrzn6-Apr-11 13:58 
AnswerRe: MoveNext is not moving next!! Pin
C#Coudou6-Apr-11 17:00
C#Coudou6-Apr-11 17:00 
AnswerRe: MoveNext is not moving next!! Pin
HaBiX6-Apr-11 21:49
HaBiX6-Apr-11 21:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.