Forum Moderators: open

Message Too Old, No Replies

Need help with Repeater control

         

brucec

2:51 pm on Jul 23, 2004 (gmt 0)

10+ Year Member



I just got into ASP.NET and I am trying to read an HTML control called pidnumber with a value property inside of a repeater.

I get a compiler error:
Compiler Error Message: BC30451: Name 'pidnumber' is not declared.

Source Error:

Line 51: dbConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; data source=" & server.mappath(dbName))
Line 52: dbConn.open()
Line 53: SqlStatement = "SELECT pid,Name,cat_id,Price,brand_id from product_search WHERE pid='" & pidnumber.value & "'"
Line 54: dbComm = new OleDbCommand(SqlStatement, dbConn)
Line 55: dataread = dbComm.ExecuteReader()

How can I solve this? Do I need to change the scope of the pidnumber variable somewhere in my code?

Easy_Coder

7:18 pm on Jul 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The compiler belives that you've not declared pidnumber. Can you post your code where your protected vars are?

TheNige

11:32 pm on Jul 23, 2004 (gmt 0)

10+ Year Member



Somewhere in your code you'll have to declare your control such as:

Protected WithEvents pidnumber as system.web.ui.webcontrols.textbox

...select what ever control you are using.

If you are using a generic HTML control and want to access it that way you need to be sure to add "runat=server" to the control and then declare it in code as well like:

Protected WithEvents pidnumber as system.web.ui.htmlcontrols.htmltextinput

...use whatever control type you need..