Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 21st, 2009, 12:02 PM
Authorized User
 
Join Date: Jul 2009
Posts: 30
Thanks: 10
Thanked 0 Times in 0 Posts
Unhappy Name 'ddlColumnName'

Error 1 Name 'ddlColumnName' is not declared.


If I declar ddlColumnName

Dim ddlColumnName As New ddlColumnName

it will ask me for type

Please can i have some help with this
  #2 (permalink)  
Old November 21st, 2009, 12:04 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

It would help if you'd specify where you get the error "Name 'ddlColumnName' is not declared."....

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
headworth (November 21st, 2009)
  #3 (permalink)  
Old November 21st, 2009, 12:13 PM
Authorized User
 
Join Date: Jul 2009
Posts: 30
Thanks: 10
Thanked 0 Times in 0 Posts
Question ddlColumnName

This is the code I am using
[Code]

Protected Sub btnFilter_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load

Dim AccessDataSource1 As New AccessDataSource


Dim FilterExpression As String = String.Concat(ddlColumnName.SelectedValue, " LIKE '%{0}%'")


AccessDataSource1.FilterParameters.Clear()


AccessDataSource1.FilterParameters.Add(New ControlParameter(ddlColumnName.SelectedValue, "txtFilterExpression", "Text"))


AccessDataSource1.FilterExpression = FilterExpression

End Sub


Protected Sub PopulateDropDownListWithColumnNames()
Dim GridView1 As New GridView
For Each col As BoundField In GridView1.Columns
ddlColumnName.Items.Add(New ListItem(col.HeaderText, col.HeaderText))
Next
End Sub
[Code\]
  #4 (permalink)  
Old November 22nd, 2009, 04:59 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

Did you copy and paste this code from some example? It looks as if ddlColumnName should be declared in the markup (with <asp:DropDownList id="ddlColumnName" runat="server" />), resulting in a drop-down list in the browser. There's not much point instantiating one in the code as it won't get a value correctly.....

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
headworth (November 22nd, 2009)
  #5 (permalink)  
Old November 22nd, 2009, 04:13 PM
Authorized User
 
Join Date: Jul 2009
Posts: 30
Thanks: 10
Thanked 0 Times in 0 Posts
Angry DataGrid to filter name

Yes I used a example and modefied it
I have tried to do this another way and it loads when i debug
But when I select a employee and press filter it will not work?



[code]
Partial Public Class _Default
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub

Protected Sub btnFilter_Click(ByVal sender As Object, ByVal e As EventArgs)

AccessDataSource1.SelectParameters.Clear()

Dim sqlSelectCommand As String = String.Concat(AccessDataSource1.SelectCommand, " WHERE Site_Employee LIKE '%'+?+'%'")

AccessDataSource1.SelectCommand = sqlSelectCommand

AccessDataSource1.SelectCommandType = SqlDataSourceCommandType.Text

AccessDataSource1.SelectParameters.Add(New ControlParameter("Site_Employee", "txtFilterCriteria", "Text"))

End Sub

Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles TextBox1.TextChanged

End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click

End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click
ResetDataSource()
End Sub

Protected Sub ResetDataSource()
'Remove the filter from the default select statement by using
'a new T-SQL statement that has no " where " clause.
AccessDataSource1.SelectCommand = "Select * From SWR2010"
End Sub
Protected Sub txtFilterCriteria_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

End Sub
End Class
  #6 (permalink)  
Old November 22nd, 2009, 04:41 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

You're not really providing the information needed to solve this problem. Since it's only a bit of code that also requires a database, it's not something we can try out in a debugger and see how it behaves. So, you'll need to provide more information. What exactly are you trying to accomplish? How does your markup section look like? What does "it will not work" mean exactly? Do you get an error? If so, which one?

And so on, and so forth.... ;-)

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
headworth (November 22nd, 2009)
  #7 (permalink)  
Old November 22nd, 2009, 05:08 PM
Authorized User
 
Join Date: Jul 2009
Posts: 30
Thanks: 10
Thanked 0 Times in 0 Posts
Question DataGrid to filter name

Can I send you the Project?
  #8 (permalink)  
Old November 22nd, 2009, 05:17 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Not if you can't explain what the problem is, or what you're trying to accomplish. I don't mind looking at your project, but I don't feel like wading through loads and loads of pages, half working code and out-dated comments ;-)

If you can't explain the desired behavior and errors you're getting for a single method in code behind, I am worried about looking at the entire project. Agree?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
headworth (November 22nd, 2009)
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off




All times are GMT -4. The time now is 12:44 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.