Hi
In our page contains a grid having 100 rows.each row has a check box to delete.User can check more than one row at a time.After the user checks more than one row, he has to click on save button.After click on Save button, we are showing confirm message box through javascript function Confirm().If the user says OK, then we need to show progressbar as server side we need to execute some code to update database and need to refresh grid agian.
But we are unable to show updateprogressbar when we click on confirm('OK').but we are successfully showing progress when we skip javascript function confirm().
Can any one has an idea how to achieve this functionality
please have a look at the related code shown in below code block.
<div><script language="javascript" type="text/javascript"> -------------- ------- some other code--- --------------------- function DeleteConfirm(sConfirmText, iProductId, iCatId) { var status = confirm(sConfirmText) if (status == true) { window.location = "../SML/SubscribedUsers.aspx?CategoryId=" + iCatId + "&Product=" + iProductId + "&PG=True" + "&Command=delete"; } else { return false; } } </script>
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"></asp:ScriptManager><asp:UpdatePanel ID="MainPanel" runat ="server"><ContentTemplate ><table id="Table1" width="100%" cellpadding="3" cellspacing="3" runat="server"><tr><td> <asp:GridView ID="gvSubscribedUsers" width="100%" runat="server" GridLines="None" CellPadding="1" CellSpacing="3" AutoGenerateColumns="false" BorderStyle="None" style="margin-top: 0px"><Columns><asp:TemplateField HeaderStyle-CssClass="gvRowHeaderStyles" HeaderStyle-HorizontalAlign="Left" ><ItemTemplate><asp:CheckBox ID="chkBoxDelete" runat="server" CssClass="buttonStyle" /><asp:HiddenField ID="hdnUserId" runat="server" Value='<%# Eval("username") %>' /></ItemTemplate><ItemStyle HorizontalAlign="Left" CssClass="MainLabelStyle"/></asp:TemplateField> <asp:TemplateField ItemStyle-CssClass="MainLabelStyle" HeaderStyle-CssClass="gvRowHeaderStyles" HeaderStyle-HorizontalAlign="Left"><ItemTemplate><asp:LinkButton ID="lnkbtnSubject" CommandArgument='<%# Eval("username") %>' CssClass="gvRowLink" runat="server" /> </ItemTemplate></asp:TemplateField><asp:BoundField DataField="Voice_Number" ItemStyle-CssClass="MainLabelStyle" HeaderStyle-HorizontalAlign="Left" HeaderStyle-CssClass="gvRowHeaderStyles" ></asp:BoundField></Columns></asp:GridView><asp:Panel ID="pnlHeader" runat="server"> <table><tr><td height="10px"></td></tr> </table><hr /></asp:Panel></td></tr> <tr><td align="left" ><asp:Button ID="btnSave" runat="server" style='cursor:hand' CssClass="buttonStyle" /> <asp:Button ID="btnClose" runat="server" style='cursor:hand' CssClass="buttonStyle" OnClientClick="window.close()" /></td></tr></table></ContentTemplate></asp:UpdatePanel>
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Try If Request.QueryString("Command") <> "" Then strCommand = Request("Command") End If If Not Request.QueryString("CategoryId") Is Nothing Then iCategoryId = Request.QueryString("CategoryId") End If If Not IsPostBack Then If strCommand = "delete" Then If Not Session("DeleteUsers") Is Nothing Then arrCheckedUserIds = Session("DeleteUsers") Dim i As Integer For i = 0 To arrCheckedUserIds.Length - 1 If arrCheckedUserIds(i) > 0 Then DeleteUserSubscription(iCategoryId, arrCheckedUserIds(i)) End If Next End If End If BindSubscribedUsers() End If Catch ex As Exception Call ReportError("Page_Load", ex) divContent.Visible = False tblError.Visible = True btnErrorClose.Text = Me.GetLocalResourceObject("Close").ToString() lblErrorDisplay.Text = ex.Message End Try End Sub Protected Sub BindSubscribedUsers() Try If Not dsUsers Is Nothing Then If dsUsers.Tables(0).Rows.Count > 0 Then gvSubscribedUsers.DataSource = dsUsers gvSubscribedUsers.DataBind() End If End If Catch ex As Exception Call ReportError("BindSubscribedUsers", ex) End Try End Sub Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSave.Click Dim iCheckedCount As Integer = 0 Dim DelUserId As Integer Try arrCheckedUserIds = New Integer(gvSubscribedUsers.Rows.Count) {} For Each row As GridViewRow In gvSubscribedUsers.Rows If row.RowType = DataControlRowType.DataRow Then Try Dim gvcheckBox As CheckBox = DirectCast(row.FindControl("chkBoxDelete"), CheckBox) If gvcheckBox.Checked = True Then iCheckedCount += 1 Dim hdnUserID As HiddenField = DirectCast(row.FindControl("hdnUserId"), HiddenField) DelUserId = hdnUserID.Value arrCheckedUserIds(iCheckedCount) = DelUserId End If Catch ex As Exception End Try End If Next If iCheckedCount > 0 Then Session("DeleteUsers") = arrCheckedUserIds sAlertMsg = Me.GetLocalResourceObject("DeleteConfirm").ToString() strScript = "javascript:DeleteConfirm('" & sAlertMsg & "'," & iProductId & "," & iCategoryId & ");" ScriptManager.RegisterStartupScript(Me.Page, Me.GetType, "DeleteConfirm", strScript, True) End If Catch ex As Exception Call ReportError("btnSave_Click", ex) End Try End Sub Protected Sub DeleteUserSubscription(ByVal iCatId As Integer, ByVal iUserName As Integer) Dim iSuccess As Integer Dim strValue As String = "" Try iSuccess = aObjSML.DeleteCategoryUserSubscription(iCatId, iUserName) Catch ex As Exception Call ReportError("DeleteUserSubscription:aObjSML.DeleteCategoryUserSubscription()", ex) strValue = ex.ToString() End Try End Sub
Please suggest me to resolve the issue how to show updateprogressbar during postback.
Thanks
</div>Please suggest me to resolve the issue how to show updateprogressbar during postback.
Thanks