示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //rpt_main.DataSource = objLinq.getAlert();
        //rpt_main.DataBind();

        rpt_images.DataSource = objImages.getImages();
        rpt_images.DataBind();
    }
    protected void subShowEditTemplate(object sender, DataListCommandEventArgs e)
    {
        imagesLinkClass objLinq = new imagesLinkClass(); //creating an object from the imagesLinkClass

        dtl_main.DataSource    = objLinq.getImages();
        dtl_main.EditItemIndex = e.Item.ItemIndex;
        dtl_main.DataBind();   //binding the DB
    }
    private void _subReset()
    {
        //lbl_message.Text = string.Empty;
        salida.Text = string.Empty;


        imagesLinkClass objLinq = new imagesLinkClass(); //creating an object from the linqClass

        dtl_main.DataSource = objLinq.getImages();
        dtl_main.DataBind(); //binding the DB
    }
    protected void subCancel(object sender, DataListCommandEventArgs e)
    {
        imagesLinkClass objLinq = new imagesLinkClass(); //creating an object from the imagesLinkClass

        dtl_main.DataSource    = objLinq.getImages();
        dtl_main.EditItemIndex = -1;
        dtl_main.DataBind();

        //frm_img.DataSource = objLinq.getImages();
        //frm_img.DataBind();
    }
    protected void subDelete(object sender, DataListCommandEventArgs e)
    {
        imagesLinkClass objLinq = new imagesLinkClass();  //creating an object from the imagesLinkClass


        HiddenField hdfID_D = (HiddenField)e.Item.FindControl("hdf_id"); // reading the id value

        int imgID_D = int.Parse(hdfID_D.Value.ToString());               //converting the id in number

        //int x = Convert.ToInt32(hdfID_D);

        _strMessage(objLinq.commitDelete(imgID_D), "delete"); // commiting the change and passing the to parameters into _strMesage


        dtl_main.DataSource    = objLinq.getImages();
        dtl_main.EditItemIndex = -1; // to go back and hide de edit panel
        dtl_main.DataBind();         //binding the DB
        _subReset();
    }
    protected void subInsert(object sender, EventArgs e)
    {
        imagesLinkClass objLinq = new imagesLinkClass(); //creating an object from the imagesLinkClass

        Button       btn_insert = (Button)sender;
        DataListItem dli        = (DataListItem)btn_insert.NamingContainer;

        TextBox txtNameI = (TextBox)dli.FindControl("txt_nameI");  //Reading the user imput
        TextBox txtlinkI = (TextBox)dli.FindControl("txt_linkI");  //Reading the user imput

        string img_path = salida.Text;

        //_strMessage(objLinq.commitInsert(img_path, txtNameI.Text, txtlinkI.Text)), "insert");

        objLinq.commitInsert(img_path, txtNameI.Text, txtlinkI.Text);

        dtl_main.DataSource = objLinq.getImages();
        dtl_main.DataBind();  //binding the DB
    }
    protected void subUpdate(object sender, DataListCommandEventArgs e)
    {
        HiddenField hdfID = (HiddenField)e.Item.FindControl("hdf_id");


        TextBox txtNameE = (TextBox)e.Item.FindControl("txt_nameE"); //Reading the user imput
        TextBox txtlinkE = (TextBox)e.Item.FindControl("txt_linkE"); //Reading the user imput


        imagesLinkClass objLinq = new imagesLinkClass(); //creating an object from the imagesLinkClass

        //string img_path = salida.Text;

        // commiting the change and passing the to parameters into _strMesage
        _strMessage(objLinq.commitUpdate(int.Parse(hdfID.Value.ToString()), txtNameE.Text, txtlinkE.Text), "update");

        dtl_main.DataSource    = objLinq.getImages();
        dtl_main.EditItemIndex = -1;
        dtl_main.DataBind(); //binding the DB
        _subReset();         // reseting textboxes
    }
示例#8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     grid_main.DataSource = objImages.getImages();
     grid_main.DataBind();
 }