.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> VB.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Display Result in gridview based on dropdownlist

Posted By: Catherine     Posted Date: April 07, 2011    Points:5   Category :VB.Net
I have two dropdownlist that not belongs to query. based on selections I need data in gridview when button clicked.

Code :

Protected Sub btngenerate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btngenerate.Click
Dim connection As OleDbConnection = New OleDbConnection(connectionString)
If ddltype.SelectedItem.Text = ("cash").ToString() Then
connection.Open()
query=""
Dim da As OleDbDataAdapter = New OleDbDataAdapter(SQLstr, connectionString)

connection.Close()
Dim ds As New DataSet()
da.Fill(ds)
GridView1.DataSource = ds
GridView1.DataBind()

End If
If ddltype.SelectedItem.Text = ("card").ToString() Then
query=""
Dim da As OleDbDataAdapter = New OleDbDataAdapter(SQLstr, connectionString)

connection.Close()
Dim ds As New DataSet()
da.Fill(ds)
GridView1.DataSource = ds
GridView1.DataBind()

End If


Responses
Author: Mahesh             
Posted Date: April 07, 2011     Points: 20   

hi,
what is the problem u r getting can u pls elaborate....

Thanks
Mahesh

Author: Sunil Yadav       [Moderator]      
Posted Date: April 07, 2011     Points: 20   

Hi,

Elaborate more on it and also check your code connection.Close() you have called this twice in your code.

Author: Catherine             
Posted Date: April 09, 2011     Points: 20   

thank you it works



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend