Category subcategory


//html part



<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="BlogPost_Grid.aspx.cs" Inherits="BlogJobPortal.Web.BlogPost_Grid" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">

      function DeleteConfirmation(Sel) {

          debugger; var hdSelectedItems = document.getElementById('<%= hdSelectedItems.ClientID%>').value;
          //    alert(hdSelectedItems);
          if (hdSelectedItems > 0) {
              if (confirm(hdSelectedItems + "   No. Of Row Selected " + "Sure! you want to" + " " + Sel + "  selected records ?") == true)
                  return true;
              else
                  return false;
          }
          else {
              alert(hdSelectedItems + "   No. Of Row Selected " + 'please select one item to' + " " + Sel);
              return false;
          }
      }
</script>
<script type="text/javascript">

    var TotalChkBx;
    var Counter;

    window.onload = function () {
        //Get total no. of CheckBoxes in side the GridView.
        TotalChkBx = parseInt('<%= this.gridBlogPost.Rows.Count %>');
        //Get total no. of checked CheckBoxes in side the GridView.
        Counter = 0;
    }

    function HeaderClick(CheckBox) {
        //Get target base & child control.
        var TargetBaseControl = document.getElementById('<%= this.gridBlogPost.ClientID %>');
        var TargetChildControl = "chkBxSelect";

        //Get all the control of the type INPUT in the base control.
        var Inputs = TargetBaseControl.getElementsByTagName("input");

        //Checked/Unchecked all the checkBoxes in side the GridView.
        for (var n = 0; n < Inputs.length; ++n)
            if (Inputs[n].type == 'checkbox' && Inputs[n].id.indexOf(TargetChildControl, 0) >= 0)
                Inputs[n].checked = CheckBox.checked;
        //Reset Counter
        Counter = CheckBox.checked ? TotalChkBx : 0;
        document.getElementById('<%= hdSelectedItems.ClientID%>').value = Counter;
    }

    function ChildClick(CheckBox, HCheckBox) {
        //get target base & child control.
        var HeaderCheckBox = document.getElementById(HCheckBox);

        //Modifiy Counter;           
        if (CheckBox.checked && Counter < TotalChkBx)
            Counter++;
        else if (Counter > 0)
            Counter--;
        document.getElementById('<%= hdSelectedItems.ClientID%>').value = Counter;
        //Change state of the header CheckBox.
        if (Counter < TotalChkBx)
            HeaderCheckBox.checked = false;
        else if (Counter == TotalChkBx)
            HeaderCheckBox.checked = true;
    }

    </script>
    <title>Admin Panel</title>
    <style type="text/css">
        .style2
        {
            width: 182px;
        }
        .style7
        {
            width: 109px;
        }
        .style8
        {
            width: 151px;
        }
        .style9
        {
            width: 331px;
        }
        .style10
        {
            width: 750px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="main">
  <div class="boxwrap">
   <div class="cormid">
       <p class="float-r">&nbsp;</p><h1>BlogPost</h1>
        <table>
        <tr><td class="style2"  align="right">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Category:</td><td class="style7">
            <asp:DropDownList ID="ddl_category" runat="server" Height="25px" Width="181px">
            </asp:DropDownList>
        </td><td width="100px" align="right"> Users:</td><td class="style8">
                <asp:DropDownList ID="DdlUsers" runat="server" Height="25px" Width="168px">
                </asp:DropDownList>
            </td><td class="style9">
                <asp:Button ID="BtnSearch" runat="server" CssClass="btn-blue1" Text="Search"
                    onclick="BtnSearch_Click" />
                <br />
            </td></tr>
        </table>
       
        <div class="stat"><a href="#"><asp:ImageButton ID="btnAddNew" ImageUrl="images/btn-addnew.gif" Text="ADD NEW"
                runat="server" CssClass="float-r" onclick="btnAddNew_Click"  /></a>
        <asp:Button ID="btn_Active" runat="server" Text="Active" CssClass="btn-blue1"
                onclick="btn_Active_Click" ToolTip="Click Here To See Activate Only"  />
         &nbsp; &nbsp; &nbsp;<asp:Button ID="btnInactive" runat="server" Text="Inactive"
                CssClass="btn-blue1" onclick="btnInactive_Click" ToolTip="Click Here To See Deactivate Only " />
                &nbsp; &nbsp; &nbsp;<asp:Button ID="btn_All_Select" runat="server" Text="View All"
                CssClass="btn-blue1" onclick="btn_All_Select_Click" ToolTip="Click Here To View All "   />
        </div>
        <div class="stat"><table height="20px"><tr><td  ><asp:Label ID="Label2" Font-Size="X-Large" Font-Bold="true" runat="server"></asp:Label></td>
        <td class="style10" align="center"><asp:Label ID="lblMSG" ForeColor="Green" Font-Bold="true"  runat="server"></asp:Label></td></tr></table>   </div>
        <div class="grid">
      
        <div class="topbar">
        <asp:HiddenField ID="hdSelectedItems" runat="server" Value="0" />
            <asp:Button ID="button1" runat="server" Text="activate Selected"
                CssClass="btn-active" onclick="btn_activeAll" OnClientClick="return DeleteConfirmation('Activate');" ToolTip="Click Here To Activate Selected " />  |
            <asp:Button ID="Btn_DeactiveAll"
                runat="server" Text="Deactivate Selected" CssClass="btn-deactive" onclick="button_Click" OnClientClick="return DeleteConfirmation('Deactivate');" ToolTip="Click Here To Deactivate Selected "
               /> |
            <asp:Button ID="btnDelete" Text="Delete Selected" runat="server"
                CssClass="btn-delete" onclick="btnDelete_Click"  OnClientClick="return DeleteConfirmation('Delete');" ToolTip="Click Here To Delete Selected "/>
        </div>
        <div class="wrapp">
        <asp:GridView ID="gridBlogPost" runat="server" AutoGenerateColumns="false"
                Width="917px"  DataKeyNames="BlogPostID"
                 GridLines="None" PagerSettings-Mode="Numeric" AllowPaging="true"
                onrowcommand="gridBlogPost_RowCommand"
                onrowdeleting="gridBlogPost_RowDeleting"
                onrowdatabound="gridBlogPost_RowDataBound"
                onpageindexchanging="gridBlogPost_PageIndexChanging" PageSize="10"  >
           
        <Columns>

            <asp:TemplateField>
           
            <HeaderTemplate>
            <asp:CheckBox ID="chkBxHeader" onclick="javascript:HeaderClick(this);" runat="server" />
           
            </HeaderTemplate>
           
         
            <ItemTemplate>
              <asp:CheckBox ID="chkBxSelect" runat="server"  />
                 <asp:HiddenField ID="hdnID" Value='<%#Eval("BlogPostID") %>' runat="server" />
            </ItemTemplate>
           
           </asp:TemplateField>
           <asp:TemplateField HeaderText="Title">
           <ItemTemplate>
           <asp:Label id="lblBlogTitle" runat="server" Text='<%#Eval("BlogPostTitle") %>'></asp:Label>
           </ItemTemplate>
           </asp:TemplateField>
          
              
            <asp:TemplateField HeaderText="image">
      <ItemTemplate>
      <asp:Image ID="img_Blog" runat="server" Height="30px" Width="50px" />
     
      </ItemTemplate>
      <EditItemTemplate>
      <asp:FileUpload ID="fu_country_image" runat="server" />
          
      </EditItemTemplate>
            </asp:TemplateField>
           
           
           <asp:TemplateField HeaderText="CreatedBy">
            <ItemTemplate>
            <asp:Label ID="lblCreatedBy" runat="server" Text='<%#Eval("UserName") %>' ></asp:Label>
            </ItemTemplate>
            <EditItemTemplate>
            <asp:TextBox ID="txtCountryName" runat="server" Text='<%#Eval("country_Title") %>' ></asp:TextBox>
            </EditItemTemplate>
             </asp:TemplateField>
          
            <asp:TemplateField HeaderText="CreatedOn">
            <ItemTemplate>
            <asp:Label ID="labCreatedOn" runat="server" Text='<%#Eval("CreatedOn") %>' ></asp:Label>
            </ItemTemplate>
            <EditItemTemplate>
            <asp:TextBox ID="txt_country_code" Text='<%#Eval("country_Code") %>' runat="server"></asp:TextBox>
            </EditItemTemplate>
             </asp:TemplateField>
           
     
           
             <asp:TemplateField HeaderText="Action">
             <ItemTemplate>
             <asp:ImageButton id="imgbtnView" runat="server" ImageUrl="~/images/iconedit.png"  CommandName="ViewDetail" Width="20px"   Height="20px"  />&nbsp; &nbsp;  
            <asp:ImageButton ID="imgStatus" runat="server" CommandName="activeInactive" Width="20px"   Height="20px"  /> &nbsp; &nbsp;           
           <asp:ImageButton ID="imgbtnDelete" runat="server"  CommandName="delete" ToolTip="Click Here To Delete" OnClientClick="return confirm('Sure want To Delete?')" />&nbsp; &nbsp;
           <asp:ImageButton ID="BtnEdit" Text="Edit" runat="server" ImageUrl="~/images/iconedit.png"  CommandName="Edit" ToolTip="Click Here To Edit" OnClientClick="return confirm('Sure want To Edit?')" />
             <asp:ImageButton id="imgBtnComment" runat="server" CommandName="Comment" Width="20px" ImageUrl="~/images/iconedit.png" CommandArgument='<%#Eval("CreatedByID") %>'   Height="20px"  ToolTip="Click Here To View Comments" OnClientClick="return confirm('Sure want To View Comments ?')"  />&nbsp; &nbsp; 
              </ItemTemplate>
            </asp:TemplateField>
           
        </Columns>
        </asp:GridView>
       
        </div>
       
        </div>
    </div>
    <div class="corbot"></div>
    </div>
   </div>

</asp:Content>


// Back code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Data;
using System.Globalization;
using BlogJobPortal.BL;
using BlogJobPortal.DL;
using BlogJobPortal.Web;

namespace BlogJobPortal.Web
{
    public partial class BlogPost_Grid : System.Web.UI.Page
    {
        List<Comp_BlogPost_gridbind> lst = new List<Comp_BlogPost_gridbind>();
        ClassBL objClassBL = new ClassBL();
        clsBlogPost objBlogPost = new clsBlogPost();
        List<tblAdminOfUser> lstuser = new List<tblAdminOfUser>();
        Class1 objclass1 = new Class1();
        string status = null;
        int level = -1;
        int d = 0;
        private static List<T_Category> lst_ParentCategory = new List<T_Category>();
        List<T_Category> lstfind = new List<T_Category>();
        int id;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["id"] == null)
            {
                Response.Redirect("loginPage.aspx");
            }
            if (!IsPostBack)
            {
                ddlUser_bind();
                CategoryDrordownBind();
                bindgrid();
            }
            lblMSG.Text = Convert.ToString(Session["msg"]);

        }

        protected void bindgrid()
        {

            lst = objBlogPost.grid_bind().ToList();
            gridBlogPost.DataSource = lst;
            gridBlogPost.DataBind();


        }
        public void ddlUser_bind()
        {

            lstuser = objBlogPost.ddluser_bind().ToList();
            DdlUsers.DataSource = lstuser;
            DdlUsers.DataTextField = "UserName";
            DdlUsers.DataValueField = "AdminId";
            DdlUsers.DataBind();
            DdlUsers.Items.Insert(0, new ListItem("Select User", "0"));
        }
        public void CategoryDrordownBind()
        {
            DataTable dtParent = new DataTable();
            //List<T_Category> lst_ParentCategory = new List<T_Category>();
            lst_ParentCategory = objclass1.Category_Table_return().ToList();
            dtParent.Columns.Add("CategoryID", typeof(int));
            dtParent.Columns.Add("CategoryName", typeof(string));
            dtParent.Columns.Add("ProductCategoryID", typeof(string));
            dtParent.Columns.Add("Status", typeof(bool));


            foreach (T_Category lst in lst_ParentCategory)
            {
                dtParent.Rows.Add(lst.CategoryID, lst.CategoryName, lst.ProductCategoryID, lst.Status);
            }

            ////Or..............

            //for (int k = 0; k < lst_ParentCategory.Count; k++)
            //{
            //    dtParent.Rows.Add(lst_ParentCategory[k].CategoryID, lst_ParentCategory[k].CategoryName, lst_ParentCategory[k].ProductCategoryID, lst_ParentCategory[k].Status);

            //}
            RecursiveFillTree(dtParent, 0);


            ddl_category.Items.Insert(0, new ListItem("Select category", "0"));

            //RecursiveFillTree(lst_ParentCategory, 0);
            // = Convert.ChangeType(lst,DataTable);
            //System.Collections.Generic.List<T_Category> obj = new System.Collections.Generic.List<T_Category>();
            //DataTable dt = GenericToDataTable.ConvertTo<T_Category>(obj);

        }

        private void RecursiveFillTree(DataTable dtParent, int parentID)
        {
            level++; //on the each call level increment 1 
            StringBuilder appender = new StringBuilder();
            for (int j = 0; j < level; j++)
                appender.Append("&nbsp;&nbsp;");
            if (level > 0)
                appender.Append("|__");

            DataView dv = new DataView(dtParent);
            dv.RowFilter = string.Format("ProductCategoryID = {0}", parentID);
            int i;
            if (dv.Count > 0)
            {
                for (i = 0; i < dv.Count; i++)
                {
                    ddl_category.Items.Add(new ListItem(Server.HtmlDecode(appender.ToString() + dv[i]["CategoryName"].ToString()), dv[i]["CategoryID"].ToString()));
                    RecursiveFillTree(dtParent, int.Parse(dv[i]["CategoryID"].ToString()));

                }
            }
            level--; //on the each function end level will decrement by 1 
        }
        protected void btnAddNew_Click(object sender, EventArgs e)
        {

        }
        protected void btn_All_Select_Click(object sender, EventArgs e)
        {
            bindgrid();

        }
        protected void btnInactive_Click(object sender, EventArgs e)
        {
            BindActiveInactive(0);
        }
        protected void btn_Active_Click(object sender, EventArgs e)
        {
            BindActiveInactive(1);

        }
       

        protected void BindActiveInactive(int b)
        {

            List<Comp_BlogPost_gridbind> lst = new List<Comp_BlogPost_gridbind>();
            lst = objBlogPost.Bind_active_inactive(b,Convert.ToInt16( ddl_category.SelectedValue),Convert.ToInt32( DdlUsers.SelectedValue)).ToList();
            gridBlogPost.DataSource = lst;
            gridBlogPost.DataBind();
        }
        protected void btn_activeAll(object sender, EventArgs e)
        {
            int count = 0;
            //int[] arryID = new int[20];
            List<int> lstId = new List<int>();
            int i = 0;
            foreach (GridViewRow gvr in gridBlogPost.Rows)
            {
                CheckBox chk1 = (CheckBox)gvr.FindControl("chkBxSelect");
                //bool result = ClientScript.RegisterClientScriptBlock("Confirm", "<script>confirm('wanna delete?');</script>");
                HiddenField hdn = (HiddenField)gvr.FindControl("hdnID");
                if (chk1.Checked)
                {
                    lstId.Add(Convert.ToInt32(hdn.Value));
                    //arryID[i] = Convert.ToInt32(hdn.Value);
                    //delete(query);
                    i++;
                    count++;
                }
            }
            if (count > 0)
            {
                try
                {
                    //ClientScript.RegisterStartupScript(this.GetType(), "", "<script>confirm(' Sure U want to delete ')</script>");
                    objBlogPost.activate_deactivate_all(lstId, 1);

                    bindgrid();
                }
                catch (Exception ex)
                {
                    //ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + ex.Message.ToString() + "')</script>");
                }
            }
            else
            {
                // lblErrorMsg.Text = "please select at least one to Activate.";
                //ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('select first ')</script>");
            }
        }
        protected void button_Click(object sender, EventArgs e)
        {
            int count = 0;
            //int[] arryID = new int[20];
            List<int> lstId = new List<int>();
            int i = 0;
            foreach (GridViewRow gvr in gridBlogPost.Rows)
            {
                CheckBox chk1 = (CheckBox)gvr.FindControl("chkBxSelect");
                //bool result = ClientScript.RegisterClientScriptBlock("Confirm", "<script>confirm('wanna delete?');</script>");
                HiddenField hdn = (HiddenField)gvr.FindControl("hdnID");
                if (chk1.Checked)
                {
                    lstId.Add(Convert.ToInt32(hdn.Value));
                    //arryID[i] = Convert.ToInt32(hdn.Value);
                    //delete(query);
                    i++;
                    count++;
                }
            }
            if (count > 0)
            {
                try
                {
                    //ClientScript.RegisterStartupScript(this.GetType(), "", "<script>confirm(' Sure U want to delete ')</script>");
                    objBlogPost.activate_deactivate_all(lstId, 2);

                    bindgrid();
                }
                catch (Exception ex)
                {
                    //ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + ex.Message.ToString() + "')</script>");
                }
            }
            else
            {
                //lblErrorMsg.Text = "please select at least one to Activate.";
                //ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('select first ')</script>");
            }
        }
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            int count = 0;
            //int[] arryID = new int[20];
            List<int> lstId = new List<int>();
            int i = 0;
            foreach (GridViewRow gvr in gridBlogPost.Rows)
            {
                CheckBox chk1 = (CheckBox)gvr.FindControl("chkBxSelect");
                //bool result = ClientScript.RegisterClientScriptBlock("Confirm", "<script>confirm('wanna delete?');</script>");
                HiddenField hdn = (HiddenField)gvr.FindControl("hdnID");
                if (chk1.Checked)
                {
                    lstId.Add(Convert.ToInt32(hdn.Value));
                    //arryID[i] = Convert.ToInt32(hdn.Value);
                    //delete(query);
                    i++;
                    count++;
                }
            }
            if (count > 0)
            {
                try
                {
                    //ClientScript.RegisterStartupScript(this.GetType(), "", "<script>confirm(' Sure U want to delete ')</script>");
                    objBlogPost.delete_selected(lstId);

                    bindgrid();
                }
                catch (Exception ex)
                {
                    //ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + ex.Message.ToString() + "')</script>");
                }
            }


        }


        protected void gridBlogPost_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {


            int id = Convert.ToInt32(gridBlogPost.DataKeys[e.RowIndex].Value);
            int checkdel = objBlogPost.DeleteRow(id);

            if (checkdel > 0)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('deleted sucessfully')</script>");
                bindgrid();
            }
            else
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('Try Again')</script>");
        }


        protected void gridBlogPost_RowCommand(object sender, GridViewCommandEventArgs e)
        {
           
            if (e.CommandName == "activeInactive")
            {
                 GridViewRow grv = (GridViewRow)((ImageButton)e.CommandSource).Parent.Parent;
                string str = Convert.ToString(e.CommandArgument);
                string[] strsplit = new string[2];
                strsplit = str.Split('/');                         // to split value manish/deepak it treats two value manish and deepak
                int categoryID = Convert.ToInt32(strsplit[1]);
                status = Convert.ToString(strsplit[0]);

                //if (status == "True")
                //{

                //    imgStatus.OnClientClick = "return confirm('Sure want To Unblock?')";
                //}
                //else if(status == "false")
                //{
                //    imgStatus.OnClientClick = "return confirm('Sure want To Block?')";
                //}

                BlockUnblock(status == "True" ? false : true, categoryID);



                bindgrid();

            }

            //GridViewRow grv = (GridViewRow)((Button)e.CommandSource).Parent.Parent;
            if (e.CommandName == "Edit")
            {
                GridViewRow grv = (GridViewRow)((ImageButton)e.CommandSource).Parent.Parent;
                // to find row
                int id = Convert.ToInt32(gridBlogPost.DataKeys[grv.RowIndex].Value);

                //string url = Convert.ToString(e.CommandArgument);
                //Session["url"] = url;
                Response.Redirect("BlogPost_Form.aspx?id=" + id);

            }
            if (e.CommandName == "ViewDetail")
            {
                GridViewRow grv = (GridViewRow)((ImageButton)e.CommandSource).Parent.Parent;
                // to find row
                int id = Convert.ToInt32(gridBlogPost.DataKeys[grv.RowIndex].Value);


                Response.Redirect("BlogPost_viewDetail.aspx?id=" + id);

            }
            if (e.CommandName == "Comment")
            {
                GridViewRow grv = (GridViewRow)((ImageButton)e.CommandSource).Parent.Parent;
                // to find row
                int id = Convert.ToInt32(gridBlogPost.DataKeys[grv.RowIndex].Value);
                Label lblCreatedBy = (Label)grv.FindControl("lblCreatedBy");
                Session["intCreatedBy"] = Convert.ToString(e.CommandArgument);
                Session["intBlogPostID"] = Convert.ToInt32(id);
                Response.Redirect("Comment_Grid_Display.aspx?id=" + id);

            }


        }

        public void BlockUnblock(bool status, int i)
        {
            int s;
            if (status == true)
            {
                s = 1;
            }
            else
                s = 0;
            objBlogPost.StatusUpdate(i, s);

        }



        protected void gridBlogPost_RowDataBound(object sender, GridViewRowEventArgs e)
        {

            if (e.Row.RowType == DataControlRowType.DataRow && (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate))
            {
                CheckBox chkBxSelect = (CheckBox)e.Row.Cells[1].FindControl("chkBxSelect");
                CheckBox chkBxHeader = (CheckBox)this.gridBlogPost.HeaderRow.FindControl("chkBxHeader");
                //CheckBox chkBx = (CheckBox)e.Row.Cells[2].FindControl("chkBx");
                chkBxSelect.Attributes["onclick"] = string.Format("javascript:ChildClick(this,'{0}');", chkBxHeader.ClientID);
            }

            if (e.Row.RowType == DataControlRowType.DataRow)
            {


                try
                {
                    Label labCreatedOn = (Label)e.Row.FindControl("labCreatedOn");

                    System.Web.UI.WebControls.Image img = (System.Web.UI.WebControls.Image)e.Row.FindControl("img_Blog");

                    img.ImageUrl = "~/BlogHendlar.ashx?id=" + DataBinder.Eval(e.Row.DataItem, "BlogPostID");
                    string strUrl = "~/BlogHendlar.ashx?id=" + DataBinder.Eval(e.Row.DataItem, "BlogPostID");
                    Session["tableName"] = "tblBlogPost";
                    //DateTime date1 =Convert.ToDateTime( lst[d].CreatedOn);labCreatedOn
                    DateTime date1 = Convert.ToDateTime(labCreatedOn.Text);
                    d++;
                    //IFormatProvider culture = new CultureInfo("en-GB");

                    string dateForm = date1.ToString("dd/MM/yyyy");

                    labCreatedOn.Text = date1.ToString("dd/MM/yyyy");


                    //ImageButton btn_Edit = (ImageButton)e.Row.FindControl("BtnEdit");
                    //btn_Edit.CommandArgument = strUrl;                                   // to find path of image

                    ImageButton imgStatus = (ImageButton)e.Row.FindControl("imgStatus");

                    imgStatus.CommandArgument = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "StatusID"))
                        + "/" + Convert.ToString(DataBinder.Eval(e.Row.DataItem, "BlogPostID"));

                    if (Convert.ToString(DataBinder.Eval(e.Row.DataItem, "StatusID")) == "True")
                    {
                        imgStatus.ImageUrl = "~/images/unblock.png";
                        imgStatus.ToolTip = "Click Here To Block";
                    }
                    else
                    {
                        imgStatus.ImageUrl = "~/images/block.png";
                        imgStatus.ToolTip = "Click Here To Unblock";
                    }

                    ImageButton BtnDelete = (ImageButton)e.Row.FindControl("imgbtnDelete");
                    BtnDelete.ImageUrl = "~/images/cross.png";



                }

                catch (Exception)
                {

                }
            }
        }
        protected void BtnSearch_Click(object sender, EventArgs e)
        {
            int categoryId = Convert.ToInt32(ddl_category.SelectedValue);
            int createdById = Convert.ToInt32(DdlUsers.SelectedValue);
            List<Comp_BlogPost_gridbind> lst = new List<Comp_BlogPost_gridbind>();
            lst = objBlogPost.Search_BindGrid(categoryId, createdById).ToList();
            gridBlogPost.DataSource = lst;
            gridBlogPost.DataBind();
        }
        protected void btnAddNew_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("BlogPost_Form.aspx");
        }

        protected void gridBlogPost_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            gridBlogPost.PageIndex = e.NewPageIndex;
            bindgrid();
        }

    }
}



No comments:

Post a Comment