Dear Sir/Madam,
protected void Page_Load(object sender, EventArgs e) {
cmd = new SqlCommand("Select ProductID, PName from tbl_Products", con);
con.Open();
DropDownList1.DataSource = cmd.ExecuteReader();
DropDownList1.DataTextField = "PName";
DropDownList1.DataValueField = "ProductID";
DropDownList1.DataBind();
}
And if i choose any one of the value from the above dropdownlist means ,
GridView wants to show the appropriate details...
My GridView as like below
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False"
DataKeyNames="ProductID">
<columns>
<asp:BoundField DataField="ProductID" HeaderText="ProductID" ReadOnly="True" />
<asp:BoundField DataField="PName" HeaderText="Product Name" ReadOnly="True" />
<asp:BoundField DataField="Manufacturer" HeaderText="Manufacturer"
ReadOnly="True" />
<asp:BoundField DataField="Rate" HeaderText="Rate" ReadOnly="True" />
</columns>
My Question is how to display appropriate details in GridView when selecting the dropdownlist item(Suppose if i select "PName1" means regarding PName1 details such as ProductID, Manufacturer, Rate wants to show in the gridview)
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
GridView2.DataSource = ds;
GridView2.DataBind();
}