Hi all ,
I am using Telerik grid to insert, update and delete records but my problem is i want to show the rad window alert message on successfull update,insert , or delete but i am unable to figure out how to trigger this.
Below is my rad grid code
This is my insert command code
The rad windows inside this is also not called
Below is the code written on item inserted
Neither this is called and works though there is successfull insert in the database.
Help is highly appreciated.
Thanks,
I am using Telerik grid to insert, update and delete records but my problem is i want to show the rad window alert message on successfull update,insert , or delete but i am unable to figure out how to trigger this.
Below is my rad grid code
<telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None" AllowPaging="True" PageSize="10" CssClass="RadGrid" AllowSorting="True" AutoGenerateColumns="False" ShowStatusBar="true" AllowAutomaticDeletes="true" AllowAutomaticUpdates="true" AllowAutomaticInserts="true" OnNeedDataSource="RadGrid1_NeedDataSource" OnUpdateCommand="RadGrid1_UpdateCommand" OnInsertCommand="RadGrid1_InsertCommand" OnDeleteCommand="RadGrid1_DeleteCommand" OnItemDeleted="RadGrid1_ItemDeleted" OnItemUpdated="RadGrid1_ItemUpdated"> <MasterTableView Width="100%" CommandItemDisplay="Top" DataKeyNames="UserId"> <Columns> <telerik:GridBoundColumn Visible="false" UniqueName="UserId" DataField="UserId" HeaderText="User Id" /> <telerik:GridBoundColumn DataField="FirstName" HeaderText="First Name" Visible="true" UniqueName="FirstName" /> <telerik:GridBoundColumn DataField="MiddleName" HeaderText="Middle Name" /> <telerik:GridBoundColumn DataField="LastName" HeaderText="Last Name" /> <%-- <telerik:GridCalculatedColumn DataFields="FirstName, MiddleName, LastName" Expression="{0} +{1} +{2}" HeaderText="Name" />--%> <telerik:GridBoundColumn DataField="UserType.UserTypeName" HeaderText="Role" /> <telerik:GridBoundColumn DataField="State.Name" HeaderText="State" /> <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" HeaderText="Edit" ButtonType="ImageButton"> </telerik:GridEditCommandColumn> <%-- <telerik:GridEditCommandColumn UniqueName="EditCommandColumn"> </telerik:GridEditCommandColumn>--%> <telerik:GridButtonColumn UniqueName="DeleteColumn" CommandName="Delete" HeaderText="Delete" ButtonType="ImageButton" ConfirmDialogType="RadWindow" ConfirmText="Are you sure, you want to delete?" ConfirmDialogHeight="100px" ConfirmTitle="Delete TIMS User"> </telerik:GridButtonColumn> </Columns> <EditFormSettings UserControlName="~/UserControls/ManageUserControls/ManageUsers.ascx" EditFormType="WebUserControl"> <EditColumn UniqueName="EditCommandColumn1"> </EditColumn> </EditFormSettings> </MasterTableView> <ClientSettings EnableAlternatingItems="true" EnableRowHoverStyle="true" Selecting-AllowRowSelect="true"> <ClientEvents OnRowDblClick="RowDblClick" /> </ClientSettings> </telerik:RadGrid>protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e) { var editedItem = e.Item as GridEditableItem; var userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID); var user = new User(); //const string radalertscript = "<script language='javascript'>function f(){radalert('Welcome to RadWindow <b>Prometheus</b>!', 330, 210); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>"; //Page.ClientScript.RegisterStartupScript(this.GetType(), "radalert", radalertscript); user.UserName = ((RadTextBox)userControl.FindControl("tbUserName")).Text; user.Password = Utility.EncryptTDC(((RadTextBox)userControl.FindControl("tbPassword")).Text); user.FirstName = ((RadTextBox)userControl.FindControl("tbFirstName")).Text; user.MiddleName = ((RadTextBox)userControl.FindControl("tbMiddleName")).Text; user.LastName = ((RadTextBox)userControl.FindControl("tbLastName")).Text; user.ContactPhoneMobile = ((RadTextBox)userControl.FindControl("tbHomePhone")).Text; user.ContactPhoneOffice = ((RadTextBox)userControl.FindControl("tbOfficePhone")).Text; if (((RadComboBox)userControl.FindControl("ddlState")).SelectedValue != "-1") user.StateId = Convert.ToInt32(((RadComboBox)userControl.FindControl("ddlState")).SelectedValue); if (((RadComboBox)userControl.FindControl("ddlInstitute")).SelectedValue != "-1") user.InstituteId = Convert.ToInt32(((RadComboBox)userControl.FindControl("ddlInstitute")).SelectedValue); if (((RadComboBox)userControl.FindControl("ddlTrainer")).SelectedValue != "-1") user.TrainerId = Convert.ToInt32(((RadComboBox)userControl.FindControl("ddlTrainer")).SelectedValue); user.UserTypeId = Convert.ToInt32(((RadComboBox)userControl.FindControl("ddlUserType")).SelectedValue); user.DateCreated = DateTime.Now; //string radalertscript = // "<script language='javascript'>function f(){radalert('main text to display', 340, 110, 'new title');}</script>"; ClientScript.RegisterStartupScript(this.GetType(), "radalert", "callAlert();", true); var userServiceContext = new TimsService<User>(); var result = userServiceContext.Create(user); if (result) { ((RadTextBox)userControl.FindControl("tbUserName")).Text = ""; ((RadTextBox)userControl.FindControl("tbPassword")).Text = ""; ((RadTextBox)userControl.FindControl("tbReEnterPassword")).Text = ""; ((RadTextBox)userControl.FindControl("tbFirstName")).Text = ""; ((RadTextBox)userControl.FindControl("tbMiddleName")).Text = ""; ((RadTextBox)userControl.FindControl("tbLastName")).Text = ""; ((RadTextBox)userControl.FindControl("tbHomePhone")).Text = ""; ((RadTextBox)userControl.FindControl("tbOfficePhone")).Text = ""; ((RadComboBox)userControl.FindControl("ddlState")).SelectedValue = "-1"; ((RadComboBox)userControl.FindControl("ddlInstitute")).SelectedValue = "-1"; ((RadComboBox)userControl.FindControl("ddlTrainer")).SelectedValue = "-1"; ((RadComboBox)userControl.FindControl("ddlUserType")).SelectedValue = "-1"; const string radalertscript = "<script language='javascript'>function f(){radalert('Welcome to RadWindow <b>Prometheus</b>!', 330, 210); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>"; Page.ClientScript.RegisterStartupScript(this.GetType(), "radalert", radalertscript, true); //RadGrid1.ItemInserted += RadGrid1_ItemInserted; } }The rad windows inside this is also not called
Below is the code written on item inserted
protected void RadGrid1_ItemInserted(object source, GridInsertedEventArgs e) { const string radalertscript = "<script language='javascript'>function f(){radalert('Welcome to RadWindow <b>Prometheus</b>!', 330, 210); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>"; Page.ClientScript.RegisterStartupScript(this.GetType(), "radalert", radalertscript, true); }Help is highly appreciated.
Thanks,