Exemple #1
0
    public void BindCountry()
    {
        int rowcount = ucCustomPagerItems.isCountRecord;
        //int? isfavorite = null; if (ddlFavorite.SelectedValue != "2") isfavorite = Convert.ToInt32(ddlFavorite.SelectedValue.ToString());
        //int? countrycode = null; if (ddlSearchCountry.SelectedValue != "0") countrycode = Convert.ToInt32(ddlSearchCountry.SelectedValue.ToString());

        string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
        int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
        {
            sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
        }


        DataTable dt = objBLLCountry.SearchCountry(txtfilter.Text != "" ? txtfilter.Text : null, sortbycoloumn, sortdirection
                                                   , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount);


        if (ucCustomPagerItems.isCountRecord == 1)
        {
            ucCustomPagerItems.CountTotalRec = rowcount.ToString();
            ucCustomPagerItems.BuildPager();
        }


        if (dt.Rows.Count > 0)
        {
            GridViewCountry.DataSource = dt;
            GridViewCountry.DataBind();
        }
        else
        {
            GridViewCountry.DataSource = dt;
            GridViewCountry.DataBind();
        }
    }
        //Execute two select queries, and returns employees and country tables
        protected void btnReturnDS_Click(object sender, EventArgs e)
        {
            // You can also use a stored procedure instead  of two queries in one string variable
            string  sql = "SELECT * FROM Employees; SELECT * FROM Country";
            DataSet ds  = SqlHelper.ExecuteQueryDS(sql, CommandType.Text, null);

            GridViewEmp.DataSource = ds.Tables[0];
            GridViewEmp.DataBind();

            GridViewCountry.DataSource = ds.Tables[1];
            GridViewCountry.DataBind();
        }
Exemple #3
0
 public void PopulateData()
 {
     try
     {
         GridViewCountry.DataSource = objVisaType.ShowCountries();
         GridViewCountry.DataBind();
     }
     catch (Exception ex)
     {
         lblMsg.Text = ex.Message;
     }
 }
Exemple #4
0
        private void bindgrid()
        {
            SqlConnection myConn    = new SqlConnection(DBConnect);
            DataTable     dtCountry = new DataTable();

            StringBuilder sqlStr = new StringBuilder();

            sqlStr.AppendLine("SELECT countryName, countryID FROM Country");

            SqlDataAdapter da = new SqlDataAdapter(sqlStr.ToString(), myConn);

            da.Fill(dtCountry);
            GridViewCountry.DataSource = dtCountry;
            GridViewCountry.DataBind();
        }
        // Execute two select queries, and returns employees and country tables
        protected void btnReturnDS_Click(object sender, EventArgs e)
        {
            // make sure parameter name of Cursor (CurEmp and CurCountry ) same as the name in the oracle PACKAGE
            string PKG_SP_Name = "GET_MULTIPLE_TABLES.GET_TABLES";

            OracleParameter[] parametersList = new OracleParameter[] {
                new OracleParameter("CurEmp", OracleDbType.RefCursor, ParameterDirection.Output),
                new OracleParameter("CurCountry", OracleDbType.RefCursor, ParameterDirection.Output),
            };
            DataSet ds = OracleHelper.ExecuteQueryDS(PKG_SP_Name, CommandType.StoredProcedure, parametersList);

            GridViewEmp.DataSource = ds.Tables[0];
            GridViewEmp.DataBind();

            GridViewCountry.DataSource = ds.Tables[1];
            GridViewCountry.DataBind();
        }