[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

need the value from a  <%#DataBinder.Eval(Container.DataItem inside of <LoggedInTemplate>

Posted on 2007-10-08
5
Medium Priority
?
486 Views
Last Modified: 2013-11-07
Here is my psudo code ...

 <asp:LoginView ID="LoginView1" runat="server">
                    <LoggedInTemplate>
                         <%#DataBinder.Eval(Container.DataItem, "ListNumber")%>
                   </LoggedInTempalte>
</asp:LoginView>

I get the error 'DataItem' is not a member of 'System.Web.UI.WebControls.LoginView'.

What do i need to do to get the ListNumber value?  BTW ... w/o the loginview, it work fine.

Cheers,

Gp.

0
Comment
Question by:timbersnow
  • 2
4 Comments
 
LVL 16

Expert Comment

by:SQL_SERVER_DBA
ID: 20034293
DataItem property is the data item represented by the DataGridItem object
in the DataGrid control.

Is there any definition of Container in your code? If not, its default
definition is:

Dim Container As System.Web.UI.Control

and

Container = CType(target.BindingContainer,System.Web.UI.Control)

Hope it helps. If you have any questions, please reply to this post.

Regards,
0
 

Author Comment

by:timbersnow
ID: 20034687
in my code behind, here's what i have:
       
        homes.DataSource = dsPaged
        homes.DataBind()
        Dim Container As System.Web.UI.Control
        Container = CType(homes.BindingContainer, System.Web.UI.Control)

Still getting BC30456: 'DataItem' is not a member of 'System.Web.UI.WebControls.LoginView'.

What am I missing?

Gp.
0
 

Author Comment

by:timbersnow
ID: 20035219
nevermind ... i worked around it with the following:

I put a hidden <asp:TextBox  ID="tbHiddenUser" runat="server" /> that i put the user name in on Page_Load ... then i created 2 divs userOn and UserOff and put the folllowing ...

                     <%If (tbHiddenUser.Text IsNot String.Empty) Then%>
                        <script type="text/javascript" >
                            document.getElementById('userOn').style.display = 'none';
                            document.getElementById('userOff').style.display = 'block';</script>
                    <%else %>
                        <script type="text/javascript" >
                            document.getElementById('userOn').style.display = 'block';
                            document.getElementById('userOff').style.display = 'none';</script>
                    <%end if %>

Am still willing to award points if there is a better way ...

Cheers,

Gp.
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 20237771
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
Suggested Courses
Course of the Month20 days, 10 hours left to enroll

868 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question