예제 #1
0
    //protected void GradeGridView_RowDataBound(object sender, GridViewRowEventArgs e)
    //{
    //    for (int i = 0; i < e.Row.Cells.Count; i++)
    //    {
    //        if (e.Row.Cells[i].Text == "&nbsp;")
    //        {
    //            e.Row.Cells[i].Text = "";
    //        }
    //    }
    //    if (e.Row.RowType == DataControlRowType.DataRow)
    //    {
    //        e.Row.Attributes["onmouseover"] = "this.style.cursor='pointer';this.style.textDecoration='underline';";
    //        e.Row.Attributes["onmouseout"] = "this.style.textDecoration='none';";
    //        e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(this.Grid_gst_rate, "Select$" + e.Row.RowIndex);
    //    }
    //}
    //protected void GradeGridView_PreRender(object sender, EventArgs e)
    //{
    //    try
    //    {
    //        Grid_gst_rate.UseAccessibleHeader = false;
    //        Grid_gst_rate.HeaderRow.TableSection = TableRowSection.TableHeader;
    //    }
    //    catch { }//vinod dont apply catch
    //}
    protected void lnkbtn_removeitem_Click(object sender, EventArgs e)
    {
        LinkButton  lb    = (LinkButton)sender;
        GridViewRow row   = (GridViewRow)lb.NamingContainer;
        int         rowID = row.RowIndex;

        if (ViewState["Travelling_grid"] != null)
        {
            DataTable dt = (DataTable)ViewState["Travelling_grid"];
            if (dt.Rows.Count >= 1)
            {
                if (row.RowIndex < dt.Rows.Count)
                {
                    d.operation("Delete  from pay_add_new_complaints where  Id = '" + dt.Rows[rowID][0] + "'");
                    dt.Rows.Remove(dt.Rows[rowID]);
                }
            }
            ViewState["Travelling_grid"] = dt;
            Grid_gst_rate.DataSource     = dt;
            Grid_gst_rate.DataBind();

            Grid_gst_rate.DataSource = dt;
            //Grid_gst_rate.DataTextField = dt.Columns[0].ToString();
            //Grid_gst_rate.DataValueField = dt.Columns[0].ToString();
            Grid_gst_rate.DataBind();
        }
    }
예제 #2
0
    protected void Travelling_Gridview1()
    {
        try
        {
            d1.con.Open();
            MySqlCommand     cmd_1 = new MySqlCommand("select ID, name,priority,comp_category from pay_add_new_complaints", d1.con);
            MySqlDataAdapter cad1  = new MySqlDataAdapter(cmd_1);
            DataTable        DS1   = new DataTable();
            cad1.Fill(DS1);
            Grid_gst_rate.DataSource     = DS1;
            ViewState["Travelling_grid"] = DS1;
            Grid_gst_rate.DataBind();

            cad1.Dispose();
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            d1.con.Close();
        }
    }