Ejemplo n.º 1
0
        protected void Button1_click1(object sender, EventArgs e)
        {
            /* TraineeDataLayer ad2 = new TraineeDataLayer();
             * int idnew = Convert.ToInt32(TextBox1.Text);   // idnew is any variable
             * var singlestudent = ad2.Datashow(idnew);
             * GridView1.DataSource = singlestudent;
             * GridView1.DataBind();  */


            TraineeDataLayer ad2 = new TraineeDataLayer();

            ad2.Tid = Convert.ToInt32(TextBox1.Text);  //Tid is propery name in class
            DataSet singlestudent = ad2.Datashow();

            if (singlestudent.Tables[0].Rows.Count == 0)
            {
                Label2.Text = "not valid";
            }
            else
            {
                Label2.Text = " ";
            }
            GridView1.DataSource = singlestudent;
            GridView1.DataBind();
        }
Ejemplo n.º 2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            TraineeDataLayer ad3 = new TraineeDataLayer();

            int    idnew1    = Convert.ToInt32(TextBox1.Text);
            string newdomain = TextBox2.Text;

            ad3.update(idnew1, newdomain);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         TraineeDataLayer ad2 = new TraineeDataLayer();
         var singlestudent    = ad2.selectfull();
         GridView1.DataSource = singlestudent;
         GridView1.DataBind();
     }
 }
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         TraineeDataLayer ad1 = new TraineeDataLayer();
         ad1.Tid        = Convert.ToInt32(TextBox1.Text);
         ad1.Tname      = TextBox2.Text;
         ad1.Location   = TextBox3.Text;
         ad1.Techdomain = TextBox4.Text;
         ad1.Startdate  = Convert.ToDateTime(TextBox5.Text);
         ad1.insert();
         //var singlestudent = ad1.getdata(idno);
         //GridView1.DataSource=singlestudent;
     }
     else
     {
         newlabel.Text = "enter all fields";
     }
 }