I am using the radcalendar in my page. if i click on the particular date on the calendar, need to open small window, i did that, in that window i have textbox , ok button in that if i enter some value in the textbox, after click ok, it should be displayed in the previous page(calendar page) on the particular date. tell me how to do this?
14 Answers, 1 is accepted
You can pass the values from the window to the main page. Please go through the following documentation for more information on this.
Using RadWindow as a Dialog
In order to set the DayCell you can try the following approach.
JavaScript:
<script type="text/javascript"> var DayCell; function OnDateClick(sender, args) { DayCell = args.get_renderDay().DomElement; } function OnClientClose(sender, args) { // get the text passed from window DayCell.innerText = "hi"; // set the day cell text } </script>Shinu.
Thanks for your reply, Can you please explain me step by step, bez i am using this as first time.
need to display some integer value (1 or 2 )from one page to radcalendar page. on the particualr date.
Here I am pasting my code:
MainPage with RadCalendar and RadWindow:
<telerik:RadWindowManager ID="IntdRadWindowManager" DestroyOnClose="false" runat="server" AutoSize="true" OnClientClose="OnClientClose"> <Windows> <telerik:RadWindow AutoSize="true" ID="RadWindow1" runat="server" NavigateUrl="window.aspx"> </telerik:RadWindow> </Windows> </telerik:RadWindowManager> <telerik:RadCalendar ID="RadCalendar1" runat="server"> <ClientEvents OnDateClick="OnDateClick" /> </telerik:RadCalendar><script type="text/javascript"> var DayCell; function OnDateClick(sender, args) { DayCell = args.get_renderDay().DomElement; // save the day-cell client object
var radWin = window.radopen("", "RadWindow1"); // open window
} function OnClientClose(sender, args) { if (args.get_argument() != null) { DayCell.innerText = args.get_argument(); // setting day-cell text
} } </script>And window page which:
<body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <input id="Button1" type="button" value="button" onclick="closeWin();" /> </div> </form></body></html><script type="text/javascript"> function closeWin() { var oWnd = GetRadWindow(); var textInput = document.getElementById("TextBox1"); oWnd.close(textInput.value); // pass the value to main page
} function GetRadWindow() { var oWindow = null; if (window.radWindow) oWindow = window.radWindow; else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; return oWindow; } </script>Hope this helps.
-Shinu.
I tried that, but that radwindow is not stay in that main page... after click on the date is opened immediately is closed.....can you tell me what to do?
I assume that you have either enabled "AutoPostBack" or using postback event for RadCalendar. And since the postback taking place, the window closes immediately after opening. Try disabling postback and see whether it helps.
Check my mark-up for RadCalendar fro the same situation.
<telerik:RadCalendar AutoPostBack="false" ID="RadCalendar1" runat="server"> <ClientEvents OnDateClick="OnDateClick" /></telerik:RadCalendar>-Shinu.
Thanks for your reply. I'll try that.
Thank you so much it works, but one moew favour i need to display two more integer values in the particular date.
ex: If i click on the particular date, popup window is opening in that need to enter 3 integer values, with the alphabets.. like V=2 , S=1, O=0.. one by one order vertically.. Tell me how to do this.? and how to save those values in the database..from the main page.
Hi Shinu,
Thank you so much it works, but one moew favour i need to display two more integer values in the particular date.
ex: If i click on the particular date, popup window is opening in that need to enter 3 integer values, with the alphabets.. like V=2 , S=1, O=0.. one by one order vertically.. Tell me how to do this.? and how to save those values in the database..from the main page
Hi Shinu,
Thank you so much it works, but one moew favour i need to display two more integer values in the particular date.
ex: If i click on the particular date, popup window is opening in that need to enter 3 integer values, with the alphabets.. like V=2 , S=1, O=0.. one by one order vertically.. Tell me how to do this.? and how to save those values in the database..from the main page
You need to modify the code little bit to accomplish the functionality. It is possible to pass object with different attributes to the main page when closing window.
In the window page, pass the object as shown below.
window.aspx:
function closeWin() { var oWnd = GetRadWindow(); var textInput1 = document.getElementById("TextBox1"); var textInput2 = document.getElementById("TextBox2"); var textInput3 = document.getElementById("TextBox3"); var value = new Object(); // Create new Object value.arg1 = textInput1.value; value.arg2 = textInput2.value; value.arg3 = textInput3.value; oWnd.close(value); // Close window and pass the values}Now, in the main page, access the values like this.
MainPage.aspx:
function OnClientClose(sender, args) { if (args.get_argument() != null) { var value = args.get_argument().arg1 + "<br />" + args.get_argument().arg2 + " <br />" + args.get_argument().arg3; DayCell.innerHTML = value; } }Hope this helps you.
Happy new year in advance ! :)
-Shinu.
It works, but need to expand the cell size to display those values vertically...... Is it possible to define cellpadding and cellspacing? Tell me how to do?
1. Need to display those values vertically
2. Need to expand the calendar cell size..
In that calendar page after displaying the values on the particular date. Need to update that values. How to do that?
I am using RadCalendar in my app. While click on the particular date opening the RadWindow. In that RadWindow i am entering three values, After closing that window those entered values are displaying on the particular date.
Now in that main page RadCalendar Page : I have three textboxes...In that after closing that RadWindow. need to display the displayed values on the date....
ex: on the date 3 : has V=1, S=1, O=1 and date 7: has V=2 , S=1, O=2.
Need to display those values and accumulate in to textboxes in the main pages
like:
Vacation : 3
Sick :2
Other:3
Tell me how to do?
In my radcalendar click on the particular date opening RadWindow.. in that i am entering values...and displaying those values on the particular cell.
I have a small question if I switch to next month will those entered values are remain on the date? Is it possible...Could you please let me know...