Hey,
Try out this sample code.. This code assumes the data in dropdownlist list
all the departments of a company, and by selecting one it list all employees
for that department..
code on page load event:
Dim myConnection As New SqlConnection();
Dim mySql as String;
myConnection.ConnectionString = "Persist Security Info=False;Integrated
Security=SSPI;database=northwind;server=mySQLServe r;Connect Timeout=30";
myConnection.Open();
if (IsPostBack)
mySQL = "SELECT * FROM employee where departmentname = '" +
dropdownlist1.selectedvalue + "'";
else
mySQL = "SELECT * FROM employee";
Dim myAdapter As New SqlDataAdapter(mySQL,myConnection);
Dim myDataSet as DataSet;
myAdapter.Fill(myDataSet, "table1");
DataGrid1.DataSource = myDataSet;
DataGrid1.DataBind();
myConnection.Close();
"riyaz" wrote:
dear mvps
i am a beginner for asp.net
,i want to produce the data in the datagrid based upon the selection from
the dropdown list.
plz give me some code for me to develop this
regards
niyaz