Exemplo n.º 1
0
    protected void BindDropMode()
    {
        Mode_mst objM = new Mode_mst();
        int      modeid;

        modeid = objMode.Get_Mode_By_Mname("web");

        objM = objMode.Get_By_id(modeid);
        colMode.Add(objM);
        drpMode.DataTextField  = "modename";
        drpMode.DataValueField = "modeid";
        drpMode.DataSource     = colMode;
        drpMode.DataBind();
    }
Exemplo n.º 2
0
    protected void Modegrdw_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        Mode_mst Obj = new Mode_mst();
        string   Modename, Description, id;
        int      Modeid = 0, count;

        Modename    = ((TextBox)Modegrdw.Rows[e.RowIndex].Cells[1].Controls[0].FindControl("txtModeName")).Text;
        Description = ((TextBox)Modegrdw.Rows[e.RowIndex].Cells[2].Controls[0].FindControl("txtDescription")).Text;
        id          = Convert.ToString(Modegrdw.Rows[e.RowIndex].Cells[0].Text);
        Modeid      = Convert.ToInt16(id);
        count       = Obj.Get_Mode_By_Mname(Modename);
        ObjMode     = ObjMode.Get_By_id(Modeid);
        if ((count == 0) && (Modename != ""))
        {
            ObjMode.Modeid      = Modeid;
            ObjMode.Description = Description;
            ObjMode.Modename    = Modename;
            ObjMode.Update();
            Modegrdw.EditIndex = -1;
            BindGrid();
            lblerrmsg.Text = Resources.MessageResource.errupdate.ToString();
        }

        else if (ObjMode.Modename == Modename)
        {
            ObjMode.Modeid      = Modeid;
            ObjMode.Description = Description;
            ObjMode.Modename    = Modename;
            ObjMode.Update();
            Modegrdw.EditIndex = -1;
            BindGrid();
            lblerrmsg.Text = Resources.MessageResource.errupdate.ToString();
        }

        else if (Modename == "")
        {
            lblerrmsg.Text = Resources.MessageResource.errnotempty.ToString();
        }

        else
        {
            lblerrmsg.Text = Resources.MessageResource.erralready.ToString();
        }
    }