protected void UserRoleGridView_PageIndexChanging(object sender, GridViewPageEventArgs e) { UserRoleGridView.PageIndex = e.NewPageIndex; UserRoleGridView.DataBind(); Displaydata(); UserRoleGridView.SelectedRowStyle.Reset(); lblmesg.Visible = false; }
protected void UserRoleGridView_PageIndexChanged(object sender, EventArgs e) { UserRoleGridView.DataBind(); Displaydata(); if (UserRoleGridView.Rows.Count > 1) { lblPageInfo.Text = String.Format("Viewing Page {0} of {1}", UserRoleGridView.PageIndex + 1, UserRoleGridView.PageCount); } UserRoleGridView.SelectedRowStyle.Reset(); }
private void SearchUser() { try { PPRDataBL obj = new PPRDataBL(); DataTable dt = new DataTable(); dt = obj.GetSearchUserRoleMappingDataBL(HttpUtility.HtmlEncode(txtSearch.Text)); if (dt.Rows.Count > 0) { UserRoleGridView.DataSource = dt; UserRoleGridView.DataBind(); } // Panelmodule.Visible = true; } catch (Exception ex) { LogError(ex); } }
public bool Displaydata() { try { PPRDataBL obj = new PPRDataBL(); DataTable dt = new DataTable(); dt = obj.GetUserRoleMappingDataBL(); if (dt.Rows.Count > 0) { UserRoleGridView.DataSource = dt; UserRoleGridView.DataBind(); } // Panelmodule.Visible = true; } catch (Exception ex) { // LogError(ex); } return(false); }
protected void btnExportExcel_Click(object sender, EventArgs e) { // Clear all content output from the buffer stream Response.ClearContent(); // Specify the default file name using "content-disposition" RESPONSE header Response.AppendHeader("content-disposition", "attachment; filename=UserRoleMapDetails" + ".xls"); // Set excel as the HTTP MIME type Response.ContentType = "application/excel"; // Create an instance of stringWriter for writing information to a string System.IO.StringWriter stringWriter = new System.IO.StringWriter(); // Create an instance of HtmlTextWriter class for writing markup // characters and text to an ASP.NET server control output stream HtmlTextWriter htw = new HtmlTextWriter(stringWriter); // Set white color as the background color for gridview header row UserRoleGridView.HeaderRow.Style.Add("background-color", "#FFFFFF"); // Set background color of each cell of GridView1 header row foreach (TableCell tableCell in UserRoleGridView.HeaderRow.Cells) { tableCell.Style["background-color"] = "#A55129"; } // Set background color of each cell of each data row of GridView1 foreach (GridViewRow gridViewRow in UserRoleGridView.Rows) { gridViewRow.BackColor = System.Drawing.Color.White; foreach (TableCell gridViewRowTableCell in gridViewRow.Cells) { gridViewRowTableCell.Style["background-color"] = "#FFF7E7"; } } UserRoleGridView.RenderControl(htw); Response.Write(stringWriter.ToString()); Response.End(); }
public void Displaydata(string MinistryId) { try { DashBoardDataBL obje = null; obje = new DashBoardDataBL(); DataTable dt = obje.GetUserRoleMapDetailBL(MinistryId); if (dt.Rows.Count > 0) { lblmsg.Visible = false; btnExportExcel.Visible = true; } else { btnExportExcel.Visible = false; } UserRoleGridView.DataSource = dt; UserRoleGridView.DataBind(); } catch (Exception ex) { LogError(ex); } }