Mini Shell

Direktori : C:/Inetpub/vhosts/protarte.com/httpdocs/admin/
Upload File :
Current File : C:/Inetpub/vhosts/protarte.com/httpdocs/admin/editar1.aspx.cs

using System;
using System.Threading;
using System.Web.UI;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Collections;
using System.Configuration;
using System.IO;
using System.Drawing.Imaging;

public partial class admin_editar1 : System.Web.UI.Page
{
    SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["protarteConnectionString"].ConnectionString);

    protected void Page_Load(object sender, EventArgs e)
    {
        SqlCommand cmd = new SqlCommand("SELECT * from produto", con);
        SqlDataAdapter sda = new SqlDataAdapter(cmd);
        DataTable dt = new DataTable();
        sda.Fill(dt);
        GridView1.DataSource = dt;
        GridView1.DataBind();
        con.Close();
    }
    protected void dp_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (dp.SelectedValue == "0")
        {

            con.Open();

            SqlCommand cmd1 = new SqlCommand("SELECT * FROM produto", con);

            SqlDataAdapter sda1 = new SqlDataAdapter(cmd1);
            DataTable dt1 = new DataTable();
            sda1.Fill(dt1);
            GridView1.DataSource = dt1;
            GridView1.DataBind();
            con.Close();
            return;
        }
      
        con.Open();

        SqlCommand cmd = new SqlCommand("SELECT * FROM produto where cat='" +dp.SelectedValue +"'", con);

        SqlDataAdapter sda = new SqlDataAdapter(cmd);
        DataTable dt = new DataTable();
        sda.Fill(dt);
        GridView1.DataSource = dt;
        GridView1.DataBind();
        con.Close();
    }
}

Zerion Mini Shell 1.0