예제 #1
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        Label   id = (Label)GridView1.Rows[e.RowIndex].FindControl("lbl_edi_id");
        TextBox f  = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txt_edit_fname");
        TextBox l  = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txt_edit_lname");

        int i = int.Parse(id.Text);

        bs.id    = i;
        bs.fname = f.Text;
        bs.lname = l.Text;

        int p = bs.bs_update(bs);

        if (p > 0)
        {
            Response.Write("Successfully");
            GridView1.EditIndex = -1;
            bind();
        }
        else
        {
            Response.Write("Try Again");
        }
    }
예제 #2
0
    protected void DataList1_UpdateCommand(object source, DataListCommandEventArgs e)
    {
        Label   id = (Label)DataList1.Items[e.Item.ItemIndex].FindControl("lbl_edit_id");
        TextBox fn = (TextBox)DataList1.Items[e.Item.ItemIndex].FindControl("TextBox1");
        TextBox ln = (TextBox)DataList1.Items[e.Item.ItemIndex].FindControl("TextBox2");

        bs.id    = int.Parse(id.Text);
        bs.fname = fn.Text;
        bs.lname = ln.Text;
        int p = bs.bs_update(bs);

        if (p > 0)
        {
            Response.Write("Success..");
        }
        else
        {
            Response.Write("Failed..");
        }
    }
예제 #3
0
    protected void ListView1_ItemUpdating(object sender, ListViewUpdateEventArgs e)
    {
        Label   id = (Label)ListView1.Items[e.ItemIndex].FindControl("lbl_edit_id");
        TextBox fn = (TextBox)ListView1.Items[e.ItemIndex].FindControl("TextBox1");
        TextBox ln = (TextBox)ListView1.Items[e.ItemIndex].FindControl("TextBox2");

        bs.id    = int.Parse(id.Text);
        bs.fname = fn.Text;
        bs.lname = ln.Text;
        int p = bs.bs_update(bs);

        if (p > 0)
        {
            Response.Write("Success..");
            ListView1.EditIndex = -1;
            display();
        }
        else
        {
            Response.Write("Failed...");
        }
    }
예제 #4
0
    protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        Label   id    = (Label)DetailsView1.Rows[0].FindControl("lbl_edit_id");
        TextBox fname = (TextBox)DetailsView1.Rows[1].FindControl("txt_fname");
        TextBox lname = (TextBox)DetailsView1.Rows[2].FindControl("txt_lname");

        bs.id    = int.Parse(id.Text);
        bs.fname = fname.Text;
        bs.lname = lname.Text;
        int p = bs.bs_update(bs);

        if (p > 0)
        {
            DetailsView1.ChangeMode(DetailsViewMode.ReadOnly);
            bind();
            Response.Write("Success..");
        }
        else
        {
            Response.Write("Failed");
        }
    }
예제 #5
0
    protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        Label   id = (Label)FormView1.FindControl("lbl_edit_id");
        TextBox fn = (TextBox)FormView1.FindControl("TextBox1");
        TextBox ln = (TextBox)FormView1.FindControl("TextBox2");

        bs.id    = int.Parse(id.Text);
        bs.fname = fn.Text;
        bs.lname = ln.Text;

        int p = bs.bs_update(bs);

        if (p > 0)
        {
            Response.Write("Success..");
            FormView1.ChangeMode(FormViewMode.ReadOnly);
            bind();
        }
        else
        {
            Response.Write("Failed...");
        }
    }
예제 #6
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        Label           id    = (Label)GridView1.Rows[e.RowIndex].FindControl("Labeledid");
        TextBox         fn    = (TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBoxfn");
        RadioButtonList gen   = (RadioButtonList)GridView1.Rows[e.RowIndex].FindControl("RadioButtonList1");
        CheckBoxList    hobby = (CheckBoxList)GridView1.Rows[e.RowIndex].FindControl("CheckBoxList1");
        ListBox         sub   = (ListBox)GridView1.Rows[e.RowIndex].FindControl("ListBox1");
        DropDownList    state = (DropDownList)GridView1.Rows[e.RowIndex].FindControl("DropDownList1");
        FileUpload      img   = (FileUpload)GridView1.Rows[e.RowIndex].FindControl("FileUpload1");
        HiddenField     h1    = (HiddenField)GridView1.Rows[e.RowIndex].FindControl("HiddenField5");



        bs.id     = int.Parse(id.Text);
        bs.fname  = fn.Text;
        bs.gender = gen.Text;

        string str = "";

        for (int i = 0; i < hobby.Items.Count; i++)
        {
            if (hobby.Items[i].Selected == true)
            {
                if (str == "")
                {
                    str = hobby.Items[i].Text;
                }
                else
                {
                    str = str + "," + hobby.Items[i].Text;
                }
            }
        }
        bs.hobby = str;
        string str1 = "";

        foreach (ListItem item in sub.Items)
        {
            if (item.Selected == true)
            {
                if (str1 == "")
                {
                    str1 = item.Text;
                }
                else
                {
                    str1 = str1 + "," + item.Text;
                }
            }
        }
        bs.subject = str1;
        bs.state   = state.Text;


        if (img.HasFile)
        {
            filename = img.FileName;
            path     = Server.MapPath("~/image/");
            fullpath = path + "\\" + filename;

            img.SaveAs(fullpath);
            temp = "~/image/" + filename;
        }
        else
        {
            temp = h1.Value;
        }
        bs.image = temp;

        try
        {
            bs.bs_update(bs);
            GridView1.EditIndex = -1;
            bind();
        }
        catch (Exception)
        {
            Response.Redirect("Default.aspx");

            //throw;
        }
    }