ramziabk
asked on
Grid View and Drop down list in VB.NET
I created a VB.net Form with Drop down list and Grid View.
Once the Form Loads, I need the user to select the ID from the Drop down list. Based on the selection, The grid view will show ONLY the details related to the select ID.
How to achieve that?
Thanks
Once the Form Loads, I need the user to select the ID from the Drop down list. Based on the selection, The grid view will show ONLY the details related to the select ID.
How to achieve that?
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Dear Code Cruiser,
I added your proposed code after editing it. I've noticed that the code in the selectedindexchanged is not being executed!!!!!
I've added a msgbox inside selectedindexchanged and when I run the project, I can view the drop down box. I can select an item in it but I'm not recieveing any msg!!!! and definitly the gridview is not changing!!
I added your proposed code after editing it. I've noticed that the code in the selectedindexchanged is not being executed!!!!!
I've added a msgbox inside selectedindexchanged and when I run the project, I can view the drop down box. I can select an item in it but I'm not recieveing any msg!!!! and definitly the gridview is not changing!!
Set the AutoPostBack of the dropdownlist to true.
ASKER
It is not working.
Is it possible the you send me the complete project. I'll change the datasource.
My database is MS SQL database.
Thanks
Is it possible the you send me the complete project. I'll change the datasource.
My database is MS SQL database.
Thanks
No I can't send the complete project as I dont have it. Show me your aspx and vb files.
ASKER
Why do you have
GridView1.Visible = False
at the top of your VB code?
GridView1.Visible = False
at the top of your VB code?
ASKER
because once I open the form, I need to see the dropdown list only. after selection, the grid view will show.
You are setting the visibility to false not true.
ASKER
That is true. Visibilty of the Grid view is false when I load the form. Once I select the value from the drop down list, I'm setting the visibility to True!
Protected Sub DropDownList1_SelectedIndexChanged(B yVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedInde xChanged
GridView1.Visible = False
>Once I select the value from the drop down list, I'm setting the visibility to True!
YOU ARE NOT.
ASKER
Appologises. It is my fault.
But anyway, I removed the GridView1.Visible = False.
Now the DropDown list is not showing any value as if there is something wrong in the connect string!!!
But anyway, I removed the GridView1.Visible = False.
Now the DropDown list is not showing any value as if there is something wrong in the connect string!!!
Do you think the connection string is correct? Does it work if you hard code the connection string in?
ASKER
The connection string is correct and it is already hardcoded.
>Now the DropDown list is not showing any value as if there is something wrong in the connect string!!!
How did you guess that then? Did you get any error?
How did you guess that then? Did you get any error?
ASKER
Since I'm not a developer, more details was needed. But I thank CodeCrusier anyway.
ASKER
Thanks