Protected Sub btnRequestFiles_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnRequestFiles.Click If RequestFiles.SelectedItems.Count = 0 Then lblNoFilesSelected.Text = "No files have been requested" Else lblNoFilesSelected.Text = "" If String.IsNullOrEmpty(txtEmail.Text) Then Dim dvEmailAddress As Data.DataView = GetEmailAddress.Select(DataSourceSelectArguments.Empty) txtEmailAddress.Text = dvEmailAddress.ToTable.Rows(0)("EmailAddress") Else txtEmailAddress.Text = txtEmail.Text End If Dim FileID As Integer Dim ArraySelectedFiles As New ArrayList For Each item As GridDataItem In RequestFiles.MasterTableView.Items If item.Selected Then Dim Filename As String = item("FileNumber").Text.ToString() Session("FileID") = Filename ArraySelectedFiles.Add(Session("FileID")) FileID = Convert.ToInt32(item.GetDataKeyValue("FileID")) 'Grab the objects out array and put into string. For Each objitem In ArraySelectedFiles.ToArray Session("PropertyString") = Session("PropertyString") & objitem.ToString lblArrayList.Text = Session("PropertyString") Next Dim conFiles As SqlConnection Dim strConnection As String Dim cmd As New SqlCommand Dim cmdinsert As SqlCommand Dim strInsert As String strConnection = ConfigurationManager.ConnectionStrings("FileawaySQLConnectionString").ConnectionString conFiles = New SqlConnection(strConnection) conFiles.Open() cmd.Connection = conFiles cmd.CommandText = "UPDATE dbo.Files SET FileStatus = 2 WHERE FileID = '" + FileID.ToString() + "'" cmd.ExecuteNonQuery() conFiles.Close() conFiles = New SqlConnection(strConnection) strInsert = "INSERT INTO dbo.FileHistory (FileID, Action, ActionedBy) VALUES (@RowID, @Action, @ActionedBy)" cmdinsert = New SqlCommand(strInsert, conFiles) cmdinsert.Parameters.AddWithValue("@RowID", FileID) cmdinsert.Parameters.AddWithValue("@Action", 2) cmdinsert.Parameters.AddWithValue("@ActionedBy", txtEmailAddress.Text) conFiles.Open() cmdinsert.ExecuteNonQuery() conFiles.Close() End If Next Me.RequestFiles.Rebind() send_email() End If Session.Remove("PropertyString") End SubDear Team,
I want to achieve the below.
I have a parent page which displays the details about a project. From this, on a button click , I open a radwindow which displays some specific details about the project which displayed in the parent window. The radpopup window has some textboxes and other controls with values along with a UPDATE button.
What I need is, if I change values in the popup and try to close the radwindow without update, it should ask me a confirmation that” Are you sure to close this window without updating your data? The changes will be lost!! Click on CANCEL to return to the window and update". If i try to close the popup radwindow after updated [ie,if I not changed any values after updated] or without any change, it should not ask the confirmation before close the radpopupwindow.
Please help me to achieve this.
<ClientSettings EnableRowHoverStyle="true"> <Selecting AllowRowSelect="True" UseClientSelectColumnOnly="True" /> <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="False" /> <ClientEvents OnRowSelected="PaymentLedgerRowSelected" /> <ClientEvents OnRequestStart="ThisEvent" /> </ClientSettings>For Each SelItem AS RadListBoxItem in Selectedlist availiablelist.Items.Add(SelItem) Next<asp:LinkButton ID="lnkComments" runat="server" Text="Add Comments"></asp:LinkButton> <div> <asp:Panel ID="panel1" runat="server" CssClass="modalPopup" Style="display: none" Width="500px" BackColor="#E6E6E6"> <p> Please add the comments</p> <asp:TextBox ID="txt_comments" runat="server" TextMode="MultiLine" Width="480px"></asp:TextBox> <div> <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel_Ok" LoadingPanelID="RadAjaxLoadingPanel1"> <asp:Button ID="OkButton" runat="server" Text="OK" OnClick="OkButton_Click" CommandName="Ok" /> <asp:Button ID="CancelButton" runat="server" Text="Cancel" /> </telerik:RadAjaxPanel> </div> </asp:Panel> </div> <div> <asp:ModalPopupExtender ID="ModalPopUp_Comments" runat="server" TargetControlID="lnkComments" PopupControlID="panel1" BackgroundCssClass="modalBackground" CancelControlID="cancelButton" DropShadow="true"> </asp:ModalPopupExtender> </div>protected void OkButton_Click(object sender, System.EventArgs e) { ModalPopupExtender ModalPopUp_Comments = (ModalPopupExtender)RadGrid_cDetailsView.MasterTableView.Items[0].FindControl("ModalPopUp_Comments"); TextBox txt_comments = (TextBox)RadGrid_cDetailsView.MasterTableView.Items[0].FindControl("txt_comments"); RadGrid RadGrid_cComments =(RadGrid) RadGrid_cDetailsView.MasterTableView.Items[0].FindControl("RadGrid_cComments"); ModalPopUp_Comments.Hide(); cComments comments = new cComments(); CiscHeader cHeader = new CiscHeader(); cHeader.cId = Request.QueryString["ID"]; if(txt_comments.Text != "") { //comments.UserId = HttpContext.Current.User.Identity.Name; // for testing purposes only comments.UserId = "Anjali"; comments.UserComment = txt_comments.Text; } cHeader.AddcComments(comments); cScoringCtrl cscoringCtrl = new cScoringCtrl(); cscoringCtrl.savecComments(cHeader); txt_comments.Text = string.Empty; cHeader.cComment.Clear(); cscoringCtrl.getcComments(cHeader); RadGrid_cComments_Bind(cHeader, RadGrid_cComments); }