Creating calendar in c#
-
Hi all I am in urgent need of help from you people. In my web page the user has to insert date several times.so i thought of creating user control.I did that and it worked nicely. but the problem in that is the calendar is opening in the page.So i want to create a window for displaying the calendar and returning the date in the textbox with only c# code i.e. No javascript. Kindly send the solution as early as possible. I want to repeat once more that i don't want javascript code to create the window only C# code is needed. Thanks in advance nauty
-
Hi all I am in urgent need of help from you people. In my web page the user has to insert date several times.so i thought of creating user control.I did that and it worked nicely. but the problem in that is the calendar is opening in the page.So i want to create a window for displaying the calendar and returning the date in the textbox with only c# code i.e. No javascript. Kindly send the solution as early as possible. I want to repeat once more that i don't want javascript code to create the window only C# code is needed. Thanks in advance nauty
I think you can use the query string instead. just create a new web form and keep the calendar control on it. then when user want to select a date open that new web form. Here the user will select the date and click ok button the calendar control web form. In the code behind for the ok button redirect the page to its origin with the selected date as query string. This link would be built when the web form is loaded from the source page, again through query string. For this solution you will have to modify the code for the source page to accept date as a query string to the page. When you get a date through query string you can easily set it to a text box control. there is some extra coding in this way but it is a simple solution for your problem. Reply me if you have some confusion. Anant Y. Kulkarni
-
Hi all I am in urgent need of help from you people. In my web page the user has to insert date several times.so i thought of creating user control.I did that and it worked nicely. but the problem in that is the calendar is opening in the page.So i want to create a window for displaying the calendar and returning the date in the textbox with only c# code i.e. No javascript. Kindly send the solution as early as possible. I want to repeat once more that i don't want javascript code to create the window only C# code is needed. Thanks in advance nauty
What you are describing is not possible without Javascript.**
xacc.ide-0.1.3.14 - Now with syntax support for PowerShell
xacc.ide-0.1.3.13 source code**
-
Hi all I am in urgent need of help from you people. In my web page the user has to insert date several times.so i thought of creating user control.I did that and it worked nicely. but the problem in that is the calendar is opening in the page.So i want to create a window for displaying the calendar and returning the date in the textbox with only c# code i.e. No javascript. Kindly send the solution as early as possible. I want to repeat once more that i don't want javascript code to create the window only C# code is needed. Thanks in advance nauty
-
I think you can use the query string instead. just create a new web form and keep the calendar control on it. then when user want to select a date open that new web form. Here the user will select the date and click ok button the calendar control web form. In the code behind for the ok button redirect the page to its origin with the selected date as query string. This link would be built when the web form is loaded from the source page, again through query string. For this solution you will have to modify the code for the source page to accept date as a query string to the page. When you get a date through query string you can easily set it to a text box control. there is some extra coding in this way but it is a simple solution for your problem. Reply me if you have some confusion. Anant Y. Kulkarni
Good approach :)**
xacc.ide-0.1.3.14 - Now with syntax support for PowerShell
xacc.ide-0.1.3.13 source code**
-
I think you can use the query string instead. just create a new web form and keep the calendar control on it. then when user want to select a date open that new web form. Here the user will select the date and click ok button the calendar control web form. In the code behind for the ok button redirect the page to its origin with the selected date as query string. This link would be built when the web form is loaded from the source page, again through query string. For this solution you will have to modify the code for the source page to accept date as a query string to the page. When you get a date through query string you can easily set it to a text box control. there is some extra coding in this way but it is a simple solution for your problem. Reply me if you have some confusion. Anant Y. Kulkarni
Hi Anant The approach is really cool.but i don't kno how new window is being made in c#(without javascript) and how to close it after redirecting it back to the parent page. could you send me some sample code. If you've the code for the same using javascript please send me. Thanks for the help. my id is ashishnautiyal@hotmail.com nauty
-
Hi Anant The approach is really cool.but i don't kno how new window is being made in c#(without javascript) and how to close it after redirecting it back to the parent page. could you send me some sample code. If you've the code for the same using javascript please send me. Thanks for the help. my id is ashishnautiyal@hotmail.com nauty
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) { // Put user code to initialize the page here try { string dt = Request.QueryString[0].ToString(); txrDate.Text = dt; } catch { } }
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) { Response.Redirect("calendar.aspx?url=webform1.aspx"); }
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 eventprivate void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here try { url = Request.QueryString[0]; } catch { } }
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) { if(url != "") { Response.Redirect(url + "?date=" + Calendar1.SelectedDate.ToShortDateString()); this.Visible=false; } }
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.:) Anant Y. Kulkarni