Click here to Skip to main content
16,005,236 members
Home / Discussions / C#
   

C#

 
Questionvoice chat white by c# Pin
majid.jannesari15-May-06 21:12
majid.jannesari15-May-06 21:12 
AnswerRe: voice chat white by c# Pin
Colin Angus Mackay15-May-06 21:13
Colin Angus Mackay15-May-06 21:13 
AnswerRe: voice chat white by c# Pin
mav.northwind15-May-06 21:51
mav.northwind15-May-06 21:51 
QuestionCreating calendar in c# Pin
nauty15-May-06 20:52
nauty15-May-06 20:52 
AnswerRe: Creating calendar in c# Pin
coolestCoder15-May-06 21:13
coolestCoder15-May-06 21:13 
GeneralRe: Creating calendar in c# Pin
leppie15-May-06 22:20
leppie15-May-06 22:20 
GeneralRe: Creating calendar in c# Pin
nauty16-May-06 2:18
nauty16-May-06 2:18 
GeneralRe: Creating calendar in c# Pin
coolestCoder16-May-06 3:24
coolestCoder16-May-06 3:24 
Hi,
First of all you create a new web form for your calendar control. That means this new web form will contain only the calendar control and the ok button. Now you modify the source web form to accept a query string named, for example date like this --

private void Page_Load(object sender, System.EventArgs e)<br />
{<br />
    // Put user code to initialize the page here<br />
    try<br />
    {<br />
        string dt = Request.QueryString[0].ToString();<br />
        txrDate.Text = dt;<br />
    }<br />
    catch<br />
    {<br />
    }<br />
}<br />



You can check for post backs according to your program logic.
The code for button which will display the calendar web form will go like this --

private void cmdDate_Click(object sender, System.EventArgs e)<br />
{<br />
    Response.Redirect("calendar.aspx?url=webform1.aspx");<br />
}


i have assumed that the calendar control is placed on calendar.aspx and the source web form is webform1.aspx


now its turn of the calendar.aspx web form
write following code in page load event

private void Page_Load(object sender, System.EventArgs e)<br />
{<br />
    // Put user code to initialize the page here<br />
    try<br />
    {<br />
        url = Request.QueryString[0];<br />
    }<br />
    catch<br />
    {<br />
    }<br />
}


here i have used a string variable named url to store the source url which will be sent to calendar.aspx through query string.


now for the ok button on calendar.aspx write this code --

		private void cmdOk_Click(object sender, System.EventArgs e)<br />
		{<br />
			if(url != "") <br />
			{<br />
				Response.Redirect(url + "?date=" + Calendar1.SelectedDate.ToShortDateString());<br />
				this.Visible=false;<br />
			}<br />
<br />
		}<br />


here my calendar control name is calendar1
this.visible=false will hide the calendar.aspx page. similarly if you want you can hide and show the source page. But be sure to check the visible property where it is to be set to true where to false.

hope you have understood the code. Its just simple.Smile | :)




Anant Y. Kulkarni
AnswerRe: Creating calendar in c# Pin
leppie15-May-06 21:14
leppie15-May-06 21:14 
AnswerRe: Creating calendar in c# Pin
papa198015-May-06 21:32
papa198015-May-06 21:32 
Questionstring to char... Pin
Prinz Ryoiji15-May-06 20:49
Prinz Ryoiji15-May-06 20:49 
AnswerRe: string to char... Pin
coolestCoder15-May-06 21:04
coolestCoder15-May-06 21:04 
AnswerRe: string to char... Pin
Guffa15-May-06 21:28
Guffa15-May-06 21:28 
QuestionProblem Sending mail from C# Pin
coolestCoder15-May-06 20:44
coolestCoder15-May-06 20:44 
AnswerRe: Problem Sending mail from C# Pin
Corinna John15-May-06 21:35
Corinna John15-May-06 21:35 
GeneralRe: Problem Sending mail from C# Pin
V.V.Thakur15-May-06 22:11
V.V.Thakur15-May-06 22:11 
GeneralRe: Problem Sending mail from C# Pin
coolestCoder15-May-06 22:42
coolestCoder15-May-06 22:42 
GeneralSaving mail from C# Pin
NortonC15-May-06 22:44
NortonC15-May-06 22:44 
GeneralRe: Saving mail from C# Pin
coolestCoder15-May-06 22:55
coolestCoder15-May-06 22:55 
GeneralRe: Saving mail from C# Pin
NortonC15-May-06 23:12
NortonC15-May-06 23:12 
GeneralRe: Saving mail from C# Pin
coolestCoder16-May-06 0:31
coolestCoder16-May-06 0:31 
GeneralRe: Problem Sending mail from C# Pin
coolestCoder15-May-06 22:40
coolestCoder15-May-06 22:40 
QuestiontheForm.InvokeRequired or theElement.InvokeRequired Pin
M-200015-May-06 20:24
M-200015-May-06 20:24 
AnswerRe: theForm.InvokeRequired or theElement.InvokeRequired Pin
Robert Rohde15-May-06 21:14
Robert Rohde15-May-06 21:14 
GeneralRe: theForm.InvokeRequired or theElement.InvokeRequired Pin
leppie15-May-06 22:21
leppie15-May-06 22:21 

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.