Пример #1
0
 /// <summary>
 /// Fill clients drop down for searching
 /// </summary>
 protected void fillclient()
 {
     objuser.clientname = "";
     objuser.action     = "select1";
     objuser.companyid  = Session["companyid"].ToString();
     objuser.id         = "";
     ds = objuser.client();
     if (ds.Tables[0].Rows.Count > 0)
     {
         dropclient.DataSource     = ds;
         dropclient.DataTextField  = "clientname";
         dropclient.DataValueField = "nid";
         dropclient.DataBind();
         //ListItem li = new ListItem("--All Clients--", "");
         //dropclient.Items.Insert(0, li);
     }
 }
 /// <summary>
 /// Fill clients
 /// </summary>
 protected void fillclient()
 {
     objuser.clientname = "";
     objuser.action     = "select";
     objuser.companyid  = Session["companyid"].ToString();
     objuser.id         = "";
     ds = objuser.client();
     if (ds.Tables[0].Rows.Count > 0)
     {
         ddlclient.DataSource     = ds;
         ddlclient.DataTextField  = "clientcodewithname";
         ddlclient.DataValueField = "nid";
         ddlclient.DataBind();
         ListItem li = new ListItem("--Select Client--", "");
         ddlclient.Items.Insert(0, li);
         ddlclient.SelectedIndex = 0;
     }
 }
        protected void fillclients()
        {
            ClsUser objuser = new ClsUser();

            objuser.action = "select";

            objuser.name      = "";
            objuser.id        = "";
            objuser.companyid = Session["companyId"].ToString();
            DataSet ds = objuser.client();

            if (ds.Tables[0].Rows.Count > 0)
            {
                dropclient.DataSource = ds;
                // dropclient.DataTextField = "clientcodewithname";
                // dropclient.DataValueField = "nid";
                dropclient.DataBind();
            }
        }
        /// <summary>
        /// Fill list of existing clients
        /// </summary>
        public void fillgrid()
        {
            objuser.clientname   = txtsearch.Text;
            objuser.action       = "select";
            objuser.companyid    = Session["companyid"].ToString();
            objuser.id           = "";
            objuser.activestatus = drostatus.Text;
            ds = objuser.client();

            DataTable dt = new DataTable();

            dt = ds.Tables[0];

            //int start = dgnews.PageSize * dgnews.PageIndex;
            //int end = start + dgnews.PageSize;
            //start = start + 1;
            //if (end >= ds.Tables[0].Rows.Count)
            //    end = ds.Tables[0].Rows.Count;
            //lblstart.Text = start.ToString();
            //lblend.Text = end.ToString();
            //lbltotalrecord.Text = ds.Tables[0].Rows.Count.ToString();

            if (ds.Tables[0].Rows.Count > 0)
            {
                //if (ViewState["SortDirection"] != null && ViewState["SortExpression"] != null)
                //{
                //    dt.DefaultView.Sort = ViewState["SortExpression"].ToString() + " " + ViewState["SortDirection"].ToString();
                //}
                Session["TaskTable"] = dt;

                dgnews.DataSource = dt;
                dgnews.DataBind();
                btnexportcsv.Enabled = true;

                nodata.Visible      = false;
                dgnews.Visible      = true;
                lnkprevious.Enabled = true;
                lnknext.Enabled     = true;
                if (lbltotalrecord.Text == lblend.Text)
                {
                    lnknext.Enabled = false;
                }
                if (lblstart.Text == "1")
                {
                    lnkprevious.Enabled = false;
                }
            }
            else
            {
                lblstart.Text       = "0";
                lnkprevious.Enabled = false;
                lnknext.Enabled     = false;
                //  btnexportcsv.Enabled = false;
                if (IsPostBack)
                {
                    nodata.Visible = true;
                }
                dgnews.Visible = false;

                Session["TaskTable"] = null;
            }
            updateData.Update();
            ScriptManager.RegisterStartupScript(updateData, updateData.GetType(), "key", "<script type='text/javascript'>fixheader();</script>", false);
        }