Question

BC30451: item not declared?

Asked by: ClassyLinks

Hi Folks.

I'm attempting to fill a form with Client data from "tblClient".  Several of these fields are listboxes, which are filled using stored procedures and are calling values from other tables.

Works fine if I don't try to put in the listboxes.

Here is the error:

BC30451: Name 'ClientOriginAreaID' is not declared.  

ClientOriginAreaID is the id of a listbox.

Any ideas why it would want me to declare it??  When i do, it still doesn't work...."not set to an instance of an obeject" errors.

Here is to code
****************************************

<%@ Page Explicit="FALSE" Language="VB" Debug="True" %>
<%@ Register TagPrefix="ATH" TagName="Header" Src="../_includes/header.ascx" %>
<%@ Register TagPrefix="ATH" TagName="LeftSide" Src="../_includes/leftside.ascx" %>
<%@ import Namespace="System.Data.SqlClient" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.OleDb" %>
<script runat="server">

    dim Connect2 AS OLEDBConnection = New OLEDBConnection
            dim connectString2 As String
   
            dim connect as SQLConnection = New SQLConnection
            dim ConnectString As String
   
            Dim RegionID AS Integer
            Dim FirstName as String
            Dim LastName as String
            Dim dtmDate As DateTime = DateTime.Now()
           
               
   
    Sub Page_load(sender as Object, e as EventArgs)
   
            If session("Role") = "" then
                Session("StartPage")= Request.ServerVariables("SCRIPT_NAME")
                response.redirect("/AccessToHousing/login.aspx")
            end if
   
            RegionID = Session("RegionID")
   
            Dim ID AS Integer
   
            ID = request.querystring("ID")
   
            ConnectString="Server=myserver; UID=mylogin; PWD=mylogin; DATABASE=accesstohousing;"
            connectstring2="Provider=SQLOLEDB;Server=myserver; UID=mylogin; PWD=mylogin; DATABASE=accesstohousing;"
   
            Connect.ConnectionString = ConnectString
            Connect2.ConnectionString= ConnectString2
   
            If Not IsPostBack then
                      connect2.open
                  Dim objCmd as New OleDbCommand("sp_listareas_display", Connect2)
                objCmd.CommandType = CommandType.StoredProcedure
              Dim objDR as OleDbDataReader
               objDR = objCmd.ExecuteReader()
   
   
               'Databind the DataReader to the listbox Web control
               
               ClientOriginAreaID.DataSource = objDR
                ClientOriginAreaID.DataBind()
                connect2.close
                connect2.open
                Dim objDR1 as OleDbDataReader
                   objDR1 = objCmd.ExecuteReader()
     
                  Client1stChoiceAreaID.DataSource = objDR1
                  Client1stChoiceAreaID.DataBind()
                connect2.close
               
                connect2.open
                Dim objDR2 as OleDbDataReader
                objDR2 = objCmd.ExecuteReader()
                     
           
                  Client2ndChoiceAreaID.DataSource = objDR2
                  Client2ndChoiceAreaID.DataBind()
                connect2.close
               
                connect2.open
              Dim reasonCmd as New OleDbCommand("sp_listreason_display", Connect2)
                reasonCmd.CommandType = CommandType.StoredProcedure
                  Dim reasonDR as OleDbDataReader
                  reasonDR = reasonCmd.ExecuteReader()

              'Databind the DataReader to the listbox Web control
                  ClientReason1ID.DataSource = reasonDR
                  ClientReason1ID.DataBind()
                          connect2.close
                connect2.open
                Dim reasonDR1 as OleDbDataReader
                  reasonDR1 = reasonCmd.ExecuteReader()

                  ClientReason2ID.DataSource = reasonDR1
                  ClientReason2ID.DataBind()
                          connect2.close
                connect2.open
                Dim typeCmd as New OleDbCommand("sp_listrestype_display", Connect2)
                typeCmd.CommandType = CommandType.StoredProcedure
                  Dim typeDR as OleDbDataReader
                  typeDR = typeCmd.ExecuteReader()
   
              'Databind the DataReader to the listbox Web control
                 Client1stChoiceResidenceType.DataSource = typeDR
                  Client1stChoiceResidenceType.DataBind()
                          connect2.close
                connect2.open
                Dim typeDR1 as OleDbDataReader
                  typeDR1 = typeCmd.ExecuteReader()

                  Client2ndChoiceResidenceType.DataSource = typeDR1
                 Client2ndChoiceResidenceType.DataBind()
   
                BindDataGrid(ID)
            end if
   
   
    End Sub
   
    Sub BindDataGrid(ID AS Integer)
   
            dim GetContactCommand AS OleDBcommand= New OleDBCommand("Select * FROM tblclients WHERE tblClients.ApplicationID="& ID, Connect2)
   
            Dim Adapter AS OleDBDataAdapter = new OleDBDataAdapter
            Adapter.Selectcommand = getContactCommand
            Adapter.SelectCommand.Connection.Open
   
            dim ContactDS AS DataSet = New DataSet
            Adapter.Fill(ContactDS, "Contact")
   
            ContactGrid.DataSource = ContactDS
   
            Page.dataBind()
    End Sub

</script>
<html>
<head>
    <title>Edit Client Information</title>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
    <meta id="GENERATOR" content="Microsoft FrontPage 6.0" />
    <meta id="ProgId" content="FrontPage.Editor.Document" />
    <link href="../_includes/master.css" type="text/css" rel="stylesheet" />
</head>
<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">
    <table style="BORDER-COLLAPSE: collapse" bordercolor="#111111" cellspacing="0" cellpadding="0" width="100%" border="0">
        <tbody>
            <tr>
                <td width="100%">
                    <ATH:header id="UserControl1" runat="server"></ATH:header>
                </td>
            </tr>
        </tbody>
    </table>
    <table style="BORDER-COLLAPSE: collapse" cellpadding="0" width="100%" border="0">
        <tbody>
            <tr>
                <td class="left" valign="top" width="150">
                    <table style="BORDER-COLLAPSE: collapse" cellpadding="0" width="150" border="0">
                        <tbody>
                            <tr>
                                <td>
                                    <ATH:Leftside id="UserControl2" runat="server"></ATH:Leftside>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </td>
                <td class="textarea" valign="top" width="100%">
                    <form runat="server">
                        <ASP:DataGrid id="ContactGrid" EnableViewState="True" AutoGenerateColumns="False" Runat="server">
                            <Columns>
                                <asp:TemplateColumn>
                                    <ItemTemplate>
                                        <p>
                                            Application Date:&nbsp;
                                            <asp:TextBox Runat="Server" id="ClientApplicationDate" columns="10" text='<%# format(Container.DataItem( "ClientApplicationDate" ), "d")%>' Enabled="False"></asp:TextBox>
                                            Date Last Updated:&nbsp;&nbsp;<asp:Textbox id="ClientUpdated" Runat="server" Text='<%#format(Container.DataItem("ClientUpdated" ),"d")%>' Enabled="False"></asp:textbox>
                                        </p>
                                        <p>
                                            First Name:&nbsp;<asp:TextBox Runat="Server" id="ClientFirstName" text='<%#Container.DataItem("ClientFirstName")%>' size="20"></asp:textbox>
                                            &nbsp;Last Name:<asp:TextBox Runat="Server" id="ClientLastName" text='<%#Container.DataItem("ClientLastName")%>' size="20"></asp:textbox>
                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                            <asp:checkbox Runat="server" id="ClientNOPrivates" checked='<%#(DataBinder.Eval(Container.DataItem, "ClientNoPrivates") = "True")%>'></ASP:CHECKBOX><font color="#FF0099">Do NOT give privates!</font>
                                        </p><p>Date of Birth:&nbsp;<asp:TextBox Runat="Server" id="ClientDOB" size="10" text='<%#format(Container.DataItem("ClientDOB"), "d")%>'></asp:textbox>
                                        </p><p>Number in Family:&nbsp;
                                            <asp:TextBox Runat="Server" id="ClientNumberInFamily" text='<%#Container.DataItem("ClientNumberInFamily")%>' columns="2"></asp:textbox>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In A Shelter Now?&nbsp;
                                            <asp:TextBox Runat="Server" id="ClientInShelter" text='<%#Container.DataItem("ClientInShelter")%>' columns="2"></asp:textbox>&nbsp;&nbsp; Release Info Ok?&nbsp;&amp;<asp:checkbox id="ClientPermission" runat="server" Checked='<%#(DataBinder.Eval(Container.DataItem,"ClientPermission")="Y") %>'></ASP:CHECKBOX>
                                        </p><p>Children Under 6:&nbsp;<asp:TextBox Runat="Server" id="ClientChildrenUnder6" text='<%#Container.DataItem("ClientChildrenUnder6")%>' columns="2"></asp:textbox>
                                            Children 7-12:&nbsp;<asp:TextBox Runat="Server" id="ClientChildrenUnder12" columns="2" text='<%#Container.DataItem("ClientChildrenUnder12")%>'></asp:textbox>
                                            &nbsp; Children 13-21:&nbsp;<asp:TextBox Runat="Server" id="ClientChildrenUnder21" columns="2" text='<%#Container.DataItem("ClientChildrenUnder21")%>'></asp:textbox>
                                            &nbsp; Total Children:&nbsp;<asp:TextBox Runat="Server" id="ClientChildrenTotal" text='<%#Container.DataItem("ClientChildrenTotal")%>' columns="2"></asp:textbox>
                                        </p><p>Other Family Info:<asp:TextBox Runat="Server" id="ClientOtherFamilyInfo" text='<%#Container.DataItem("ClientOtherFamilyInfo")%>' size="20"></asp:textbox>
                                            &nbsp;&nbsp; Spousal D.O.B.&nbsp;
                                            <asp:TextBox Runat="Server" id="ClientSpousalDOB" size="20" text='<%#format(Container.DataItem("ClientSpousalDOB"), "d")%>'></asp:textbox></p><p>Phone:&nbsp;
                                            <asp:TextBox Runat="Server" id="ClientPhone" text='<%#Container.DataItem("ClientPhone")%>' size="20"></asp:textbox>&nbsp;&nbsp;
                                        </p><P>Primary Reason for Leaving:<asp:listbox Runat="server" rows="1" id="ClientReason1ID" DataTextField="ReasonforLeaving" DataValueField="ReasonID" />
                                                    </asp:listbox><p>Secondary Reason for Leaving:<asp:listbox Runat="server" rows="1" id="ClientReason2ID" DataTextField="ReasonforLeaving" DataValueField="ReasonID" />
                                         <p>First Choice Area:&nbsp;&nbsp;<asp:listbox Runat="server" rows="1" id="Client1stChoiceAreaID" DataTextField="AREAName" DataValueField="AREAID" />
                                                        </asp:listbox>&nbsp;&nbsp;
                                         First Choice Residence:&nbsp;&nbsp;<asp:listbox Runat="server" rows="1" id="Client1stChoiceResidenceType" DataTextField="ResidenceTypeCode" DataValueField="ResidenceID" />
                                                    </asp:listbox>Second Choice Area:&nbsp;<asp:listbox Runat="server" rows="1" id="Client2ndChoiceAreaID" DataTextField="AREAName" DataValueField="AREAID" />
                                                    </asp:listbox></p><P><XXXXIMPLIED_P><XXXXIMPLIED_P>Second Choice Residence:<asp:listbox Runat="server" rows="1" id="Client2ndChoiceResidenceType" DataTextField="ResidenceTypeCode" DataValueField="ResidenceID" />
                                                    </asp:listbox><P>Date Needed:&nbsp;<asp:TextBox Runat="Server" id="ClientNeedDate" text='<%#Container.DataItem("ClientNeedDate")%>' size="20"></asp:textbox>
                                                &nbsp;Immediately?&nbsp;
                                                <asp:checkbox Runat="server" id="ClientImmediateNeed" checked='<%#(Databinder.eval(Container.DataItem, "ClientImmediateNeed") = "Y")%>'></ASP:CHECKBOX>&nbsp;Notice Given?
                                    <asp:checkbox Runat="server" id="ClientNotice" checked='<%#(DataBinder.eval(Container.DataItem, "ClientNotice") = "Y")%>'></ASP:CHECKBOX><P><P></p><p>Monthly Income:&nbsp;<asp:TextBox Runat="Server" id="ClientMoIncome" size="3" text='<%#Container.DataItem("ClientMoIncome")%>'></asp:textbox>
                                        &nbsp;&nbsp;Top Price:&nbsp;&nbsp;<asp:TextBox Runat="Server" id="ClientTopAmount" size="3" text='<%#Container.DataItem("ClientTopAmount")%>'></asp:textbox>
                                        &nbsp;&nbsp;Ideal Maximum Rent:<asp:TextBox Runat="Server" id="ClientIdealRent" size="6" disabled="disabled" text='<%#Container.DataItem("ClientMoIncome")*.33%>'></asp:textbox>
                                    </p><p></p><p>Has 1st &amp; Last?&nbsp;&nbsp;<input type="checkbox" id="Client1stLast" value="1" />
                                        &nbsp;&nbsp; References?<asp:checkbox Runat="server" id="ClientHaveRefs" checked='<%#(Databinder.eval(Container.DataItem, "ClientHaveRefs")="1")%>'/>
                                    </p><p>Where From?&nbsp;
                                        <asp:listbox size="1" id="ClientOriginAreaID" Rows="1" DataTextField="AreaName" DataValueField="AreaID" runat="server" /></asp:listbox></p><p>Risk of Homelessness?<asp:TextBox Runat="Server" id="ClientHomelessRisk" text='<%#Container.DataItem("ClientHomelessRisk")%>' columns="2"></asp:textbox>
                                        &nbsp; Children Homeless:&nbsp;<asp:TextBox Runat="Server" id="ClientChildrenHomeless" text='<%#Container.DataItem("ClientChildrenHomeless")%>' columns="2"></asp:textbox>
                                        &nbsp;Number Affected:<asp:TextBox Runat="Server" id="ClientNumberAffected" text='<%#Container.DataItem("ClientNumberAffected")%>' columns="2"></asp:textbox>
                                    </p><p>Employed:<asp:TextBox Runat="Server" id="ClientEmployed" text='<%#Container.DataItem("ClientEmployed")%>' columns="2"></asp:textbox>
                                    </p><p><b>Job Sector:</b>&nbsp;Trade&nbsp;<asp:TextBox Runat="Server" id="ClientJobTrade" text='<%#Container.DataItem("ClientJobTrade")%>' columns="2"></asp:textbox>
                                        &nbsp;&nbsp;Professional<asp:TextBox Runat="Server" id="ClientJobProff" text='<%#Container.DataItem("ClientJobProff")%>' columns="2"></asp:textbox>
                                        &nbsp;&nbsp;Service:&nbsp;&nbsp;IntraWest<asp:TextBox Runat="Server" id="ClientIW" text='<%#Container.DataItem("ClientIW")%>' columns="2"></asp:textbox>
                                        BlueMtn<asp:TextBox Runat="Server" id="ClientBM" text='<%#Container.DataItem("ClientBM")%>' columns="2"></asp:textbox>
                                        Other&nbsp;<asp:TextBox Runat="Server" id="ClientJobSvc" text='<%#Container.DataItem("ClientJobSvc")%>' columns="2"></asp:textbox>
                                    </p><p><b>Manufacturing:</b>VOABYP&nbsp;<asp:TextBox Runat="Server" id="ClientVOABYP" text='<%#Container.DataItem("ClientVOABYP")%>' columns="2"></asp:textbox>
                                        &nbsp;LOF&nbsp;<asp:TextBox Runat="Server" id="ClientLOF" text='<%#Container.DataItem("ClientLOF")%>' columns="2"></asp:textbox>
                                        &nbsp;GY&nbsp;<asp:TextBox Runat="Server" id="ClientGY" text='<%#Container.DataItem("ClientGY")%>' columns="2"></asp:textbox>
                                        &nbsp;RLAlcoa<asp:TextBox Runat="Server" id="ClientRLAlcoa" text='<%#Container.DataItem("ClientRLAlcoa")%>' columns="2"></asp:textbox>
                                        &nbsp;Other<asp:TextBox Runat="Server" id="ClientJobMan" text='<%#Container.DataItem("ClientJobMan")%>' columns="2"></asp:textbox>
                                    </p><p>Pension/Benefits&nbsp;&nbsp;<asp:TextBox Runat="Server" id="ClientPensionBenefits" text='<%#Container.DataItem("ClientPensionBenefits")%>' columns="2"></asp:textbox>
                                        &nbsp;Disability&nbsp;<asp:TextBox Runat="Server" id="ClientDisability" text='<%#Container.DataItem("ClientDisability")%>' columns="2"></asp:textbox>
                                        &nbsp;EI/SickPay<asp:TextBox Runat="Server" id="ClientEISickPay" text='<%#Container.DataItem("ClientEISickPay")%>' columns="2"></asp:textbox>
                                        &nbsp;Work/Family Benefits&nbsp;<asp:TextBox Runat="Server" id="ClientWorkFamilyBenes" text='<%#Container.DataItem("ClientWorkFamilyBenes")%>' columns="2"></asp:textbox>
                                        &nbsp;<br />Child Support&nbsp;<asp:TextBox Runat="Server" id="ClientChildSupport" text='<%#Container.DataItem("ClientChildSupport")%>' columns="2"></asp:textbox>
                                        &nbsp;Child Aid&nbsp;<asp:TextBox Runat="Server" id="ClientChildAid" text='<%#Container.DataItem("ClientChildAid")%>' columns="2"></asp:textbox>
                                        &nbsp;Child Tax&nbsp;<asp:TextBox Runat="Server" id="ClientChildTax" text='<%#Container.DataItem("ClientChildTax")%>' columns="2"></asp:textbox>
                                        &nbsp;Ont Works?<asp:TextBox Runat="Server" id="ClientOntWeeks" text='<%#Container.DataItem("ClientOntWeeks")%>' columns="2"></asp:textbox>
                                    </p><p>Comments:
                                    </p><p></p><asp:textbox runat="server" id="ClientComments" textmode="multiline" text='<%#Container.DataItem("ClientComments")%>' columns="2"></asp:textbox<hr /><p>Number Housed?&nbsp;&nbsp;<asp:TextBox Runat="Server" id="ClientHousebyNo" text='<%#Container.DataItem("ClientHouseByNo")%>' columns="2"></asp:textbox>
                                        &nbsp;&nbsp; Unit Housed?&nbsp;<asp:TextBox Runat="Server" id="ClientHousebyUnit" text='<%#Container.DataItem("ClientHouseByUnit")%>' columns="2"></asp:textbox>
                                        &nbsp;Lost Contact<asp:TextBox Runat="Server" id="ClientLostContact" columns="2" text='<%#Container.DataItem("ClientLostContact")%>'></asp:textbox>
                                        &nbsp;Flex Units<asp:TextBox Runat="Server" id="ClientFlexUnits" columns="2" text='<%#Container.DataItem("ClientFlexUnits")%>'></asp:textbox>
                                        &nbsp;Stayed in Same:&nbsp;<asp:TextBox Runat="Server" id="ClientStayHome" text='<%#Container.DataItem("ClientStayHome")%>' columns="2"></asp:textbox>
                                        <br />Date Housed?<asp:TextBox Runat="Server" id="HouseDate" size="18" text='<%#format(Container.DataItem("HouseDate"), "d")%>' ></asp:textbox>
                                    </p><p><input type="submit" value="Make Changes to this Client" id="Edit" />
                                        <input type="reset" value="Clear All Fields" id="Reset" />
                                    </p></ItemTemplate></asp:TemplateColumn></Columns></ASP:DataGrid>
&nbsp;&nbsp;&nbsp;&nbsp;</form>
                                </td>
                                </tr>
                                </tbody>
                                </table>
                                </body>
                                </html>

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2004-10-04 at 10:24:48ID21155222
Tags

name

,

bc30451

,

declared

Topic

Programming for ASP.NET

Participating Experts
2
Points
500
Comments
23

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. ASP.NET command to insert values in sql database: Com…
    Hello!! I have two questions: 1)Is the attached code the best way to insert data in sql database or you will reconmned to use another code? 2)Why it says Compiler Error Message: BC30451: Name 'CommandType' is not declared. Code <script runat="server"> ...
  2. BC30451: Name 'Response' is not declared??
    What in the world is going on? I published my website in VS2005, and now all of a sudden I get this error: BC30451: Name 'Response' is not declared Where Response is the beginning of a line... Response.write("..."). Works fine if I just run the site on my local ...
  3. BC30451 Error
    Hi Im using Dreamweaver 8 to develop aspx file using version 1.1 for dot net framework. I recieving error on line: Compiler Error Message: BC30451: Name 'ddlGateway' is not declared. Source Error: Line 29: Dim nodeGateway As XmlNode Line 30: ...
  4. Error BC30451
    Hi I'm getting the following: "There were build errors. Would you like to continue and run the last successful update?" In the "error list", i can't see any error, and if i click yes, i can run successfully my page. But in the output tag that opens upon ...
  5. Why am I getting a Compiler Error Message: BC30451…
    I want to create a single script to handle all of my DB operations from a flex interface. All I need to do is store the DB table fields in an array and get the target array to build my sql statements and form variable requests. I am getting a Compiler Error Message: BC30451...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: dabitbolPosted on 2004-10-04 at 10:39:08ID: 12219413

The problem is that your control resides inside your DataGrid. So your page doesn't see it.
You are going to have to get your collection from a function.

 

by: ClassyLinksPosted on 2004-10-04 at 10:42:30ID: 12219442

hmmm....how would I do that??

 

by: ThogekPosted on 2004-10-04 at 10:43:01ID: 12219447

I suspect that this is because your page does not contain a declared object ID'd as "ClientOriginAreaID".

The ClientOriginAreaID object you do have is declared within your DataGrid's TemplateColumn's ItemTemplate, which means that there will be one of these added to the DataGrid for each DataRow within the DataGrid's data source.

You could try creating an ItemDataBound event handler for your DataGrid object, and moving your ClientOriginAreaID-related code inside that event handler's method, which would fire once per DataRow as each row is bound to the DataGrid.

DataGrid.ItemDataBound event: http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwebuiwebcontrolsdatagridclassitemdataboundtopic.asp

 

by: ThogekPosted on 2004-10-04 at 10:43:58ID: 12219455

Whoops.  dabitbol posted part of my comment while I was still writing it.  (Didn't mean ta parrot ya there. ;-)

 

by: dabitbolPosted on 2004-10-04 at 10:48:30ID: 12219492

Basically, what he's saying is something that looks like this:

public Sub ContactGrid_OnItemDataBound(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptr.ItemDataBound
   Dim rec As DataRowView
   rec = e.Item.DataItem

   'Make sure that you have the data.
   If Not IsDBNull(rec) Then
      Dim l1 As ListBox
      l1 = e.Item.FindControl("ClientOriginAreaID")
      Dim objCmd as New OleDbCommand("sp_listareas_display", Connect2)
                objCmd.CommandType = CommandType.StoredProcedure
              Dim objDR as OleDbDataReader
               objDR = objCmd.ExecuteReader()
   
   
               'Databind the DataReader to the listbox Web control
               
               l1.DataSource = objDR
                l1.DataBind()
                connect2.close
   End If
End Sub

And BDW Thogek no problem :) I share!

Good Luck

 

by: ClassyLinksPosted on 2004-10-04 at 11:34:19ID: 12219872

thanks folks....

I'm gettng this error:   Handles clause requires a WithEvents variable.

On this line:

Line 49:     public Sub ContactGrid_OnItemDataBound(ByVal sender As Object, _
Line 50: ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptr.ItemDataBound

 

by: dabitbolPosted on 2004-10-04 at 11:45:41ID: 12219976

Sorry you have to declare it this way:

ContactGrid_OnItemDataBound(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles ContactGrid.ItemDataBound

David

 

by: dabitbolPosted on 2004-10-04 at 11:50:28ID: 12220013

And your Page_Load shoul be declared like this (I think, I'm a C# Programmer)


Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
...
...
...
End Sub

David

 

by: ThogekPosted on 2004-10-04 at 11:51:31ID: 12220025

Yeah, yeah.  What dabitbol said.  ;-)

 

by: ClassyLinksPosted on 2004-10-04 at 12:08:28ID: 12220166

:((

Changed Page_Load & ContactGrid_OnItemDataBound.....same error.

Any ideas??

 

by: dabitbolPosted on 2004-10-04 at 12:16:28ID: 12220259

Gimme a minute

 

by: dabitbolPosted on 2004-10-04 at 12:20:05ID: 12220306

try adding this tag to your DataGrid because since you're using inline script it's a problem. So add this:

<asp:DataGrid ... OnItemDataBound="ContactGrid_OnItemDataBound" ... >

 

by: dabitbolPosted on 2004-10-04 at 12:21:54ID: 12220324

And Remove the HAndles Clause:

ContactGrid_OnItemDataBound(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs)

 

by: ClassyLinksPosted on 2004-10-04 at 12:22:24ID: 12220331

:((

Same error.

 

by: dabitbolPosted on 2004-10-04 at 12:22:49ID: 12220336

And Remove the HAndles Clause:

ContactGrid_OnItemDataBound(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs)

 

by: dabitbolPosted on 2004-10-04 at 12:24:44ID: 12220358

Oh Sorry, Another Error is this:


ContactGrid_OnItemDataBound(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)


Deeply Sorry!!!

 

by: ThogekPosted on 2004-10-04 at 12:24:57ID: 12220364

I'm no VB expert, either, but...
Does adding
    OnItemDataBound="ContactGrid_OnItemDataBound"
into your <asp:DataGrid> tag make any difference?

 

by: ThogekPosted on 2004-10-04 at 12:25:22ID: 12220369

Doh.  Too slow again....

 

by: ClassyLinksPosted on 2004-10-05 at 06:06:25ID: 12226172

Hi Folks....still there??

No luck with adding the onItemDataBound to the datagrid.....any mroe ideas??

 

by: dabitbolPosted on 2004-10-05 at 07:59:07ID: 12227338

What's the result?

 

by: ClassyLinksPosted on 2004-10-05 at 08:25:23ID: 12227632

Hey all!

I've got it wokring...thanks for you help.

Went a slightly different route:

'*******************************************
   
    Private Function BindState()
        Dim myCommand As SqlCommand = New SqlCommand("sp_listareas_display", Connect)

        myCommand.CommandType = CommandType.StoredProcedure
            'myCommand.Parameters.Add("@RegionId", RegionID)

        Connect.Open()
        Return myCommand.ExecuteReader(CommandBehavior.CloseConnection)
    End Function
 
  Dim strCurrentState as Integer
 
Private Sub DG_ItemDataBound(s as object, e as DataGridItemEventArgs)
 
Dim cboStateTemp As DropDownList = CType(e.Item.FindControl("ClientOriginAreaID"), DropDownList)
Dim strTemp as String = cboStateTemp.SelectedItem.Value

       Dim myDropDown as DropDownList
       myDropDown = Ctype(e.Item.FindControl("ClientOriginAreaID"), DropDownList)
       myDropDown.SelectedIndex = myDropDown.Items.IndexOf(myDropDown.items.findbytext(strCurrentState))

End Sub

'*******************************************

And then used the dropdownlist like this:

       <asp:DropDownList
                id="ClientOriginAreaID"
             DataSource="<%# BindState() %>"
                        DataTextField="AreaName"
                        DataTextValue="AreaID"
            runat="server"/>

Works great.,.....now, if I can only get the Selected Index to be the value found in the TblClients......I can either open that in another question or maybe you have some ideas??

Thanks!

 

by: dabitbolPosted on 2004-10-05 at 08:26:57ID: 12227649

That I know you won't ba able to. But then again, it's another story!

No prob for the help!

 

by: ClassyLinksPosted on 2004-10-05 at 08:41:07ID: 12227833

thanks for your help....off to the next challenge.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...