| <head runat="server"> |
| <title></title> |
| <telerik:RadCodeBlock ID="cb1" runat="server"> |
| <script type="text/javascript"> |
| function InitiateAjaxRequest(arguments) { |
| var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>"); |
| if (ajaxManager) ajaxManager.ajaxRequest(arguments); |
| } |
| </script> |
| </telerik:RadCodeBlock> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <div> |
| <script type="text/javascript"> |
| function OnClientFileSelected(radUpload, eventArgs) { |
| var input = eventArgs.get_fileInputField(); |
| var FileString = "UploadFile" + "|" + input.value; |
| InitiateAjaxRequest(FileString); |
| } |
| function confirmCallBackFn(arg) { |
| result = radalert("Confirm returned the following result: " + arg); |
| InitiateAjaxRequest('confirm|' + result); |
| } |
| </script> |
| <div> |
| <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"> |
| </telerik:RadAjaxManager> |
| <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> |
| </telerik:RadScriptManager> |
| </div> |
| <div> |
| <telerik:RadUpload ID="RadUpload1" runat="server" Skin="Forest" OnClientFileSelected="OnClientFileSelected"> |
| </telerik:RadUpload> |
| </div> |
| <div> |
| <telerik:RadWindowManager ID="RadWindowManager1" runat="server"> |
| </telerik:RadWindowManager> |
| </div> |
| <div> |
| <input id="Button1" type="button" value="clientside button" onclick="javascript:InitiateAjaxRequest('btn|a');" /> |
| </div> |
| <div> |
| <input id="Button2" type="button" value="show CONFIRM BOX" onclick="radconfirm('Are you sure?', confirmCallBackFn); return false;" /> |
| </div> |
| </div> |
| </form> |
| </body> |
function confirmAddressChange() { if (document.forms[0].hfAddressChange.value =="") { var res = (confirm('Update Contact Addresses to Match?')==true); document.forms[0].hfAddressChange.value = res; } return true; }
<rad:RadMenuItem ID="rmitmUpdateInfo" runat="server" ImageUrl="~/Images_ABL_Std/Grid/Update.gif" Text="Update" Value="update" ToolTip="Accept changes" OnClientItemClicking ="confirmAddressChange()"> </rad:RadMenuItem> What I need to happen is to have the page run the javascript, where I set the value of a hidden field, then run the server code. At this point it skips the javascript and goes directly to the server code.
Anyone have a suggestion or answer?
Thanks.



Heey
I have a strange error when i try to uppdate my data in db an Error appears( Value of '0001-01-01 00:00:00' is not valid for 'SelectedDate'. 'SelectedDate' should be between 'MinDate' and 'MaxDate'. Parameter name: SelectedDate)
Story: I have a grid in in my UserEditPanel where i try to create users that works perfectly but in this same UserEditPanel there is a little gird where you can add (with new record button) FromDate ToDate WorkingTime and VacationDays for one user that is in same time how to say in creation . if I try to save/update it wont it just reset only in the fields FromDate and ToDate to (0001-01-01 00:00:00') some help would be just awesome btw i'm working with Viewstate
I think that the error appears in this part of the code and i really dont know what is wrong here ...
<telerik:RadDatePicker ID="fromdatepicker" runat="server" DbSelectedDate='<%# Eval("FromDate") == null ? null : Eval("FromDate") %>' TabIndex="4">
</telerik:RadDatePicker>
</td>
</tr>
<tr>
<td>To</td>
<td>
<telerik:RadDatePicker ID="todatepicker" runat="server" DbSelectedDate='<%# Eval("ToDate") == null ? null :Eval("ToDate")%>'
TabIndex="4">
</telerik:RadDatePicker>
<asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'></asp:Button> </div> </td> <td> <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancle" OnClick="btnCancel_Click"></asp:Button> </td> </tr> </table> </FormTemplate> </EditFormSettings> </MasterTableView> <FilterMenu EnableImageSprites="False"> </FilterMenu> </telerik:RadGrid> </telerik:RadAjaxPanel> </div> <div class="BackAndSave"> <telerik:RadButton ID="rbBack" CssClass="rowButton" runat="server" Text="Back" OnClick="rbBack_Clicked" CausesValidation="false" /> <telerik:RadButton ID="rbSave" CssClass="rowButton" runat="server" Text="Save" OnClick="rbSave_Clicked" />protected void rgAnnualVacation_UpdateCommand(object sender, GridCommandEventArgs e) { try { GridEditableItem item = e.Item as GridEditableItem; Hashtable values = new Hashtable(); item.ExtractValues(values); AnnualVacation editedAnnualVacation = new AnnualVacation(); item.UpdateValues(editedAnnualVacation); //newAnnualVacation.IsNew = true; List<AnnualVacation> annualVacationSource = (List<AnnualVacation>)ViewState["AnnualVacationSource"]; AnnualVacation existingAnnualVacation = annualVacationSource.Where(av => av.AnnualVacationId == editedAnnualVacation.AnnualVacationId).FirstOrDefault(); existingAnnualVacation.WorkingTime = editedAnnualVacation.WorkingTime; existingAnnualVacation.VacationDays = editedAnnualVacation.VacationDays; //Set values to zero when update existingAnnualVacation.FromDate = editedAnnualVacation.FromDate; existingAnnualVacation.ToDate = editedAnnualVacation.ToDate; } catch { //Hier fehlermeldung } }