Solved

dynamic binding listview asp.net 3.5

Posted on 2010-08-31
7
512 Views
Last Modified: 2012-06-27
How Can I bind the ID column of my Access Datasource into this code, this as is is static  but I need dynamic
Protected Sub ListView1_ItemDataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.ItemDataBound

        Dim myButtonPrint As Button = CType(ListView1.FindControl("PrintButton"), Button)
        myButtonPrint.PostBackUrl = "PrintableProviderList.aspx?Id=132"
    End Sub

Open in new window

0
Comment
Question by:TonyReba
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 3

Accepted Solution

by:
omnimaven earned 400 total points
ID: 33571672
you can do something like:

myButtonPrint.PostBackUrl = "PrintableProviderList.aspx?Id=" & CType(e.item.DataItem, DataRowView)["ID"].ToString()
0
 
LVL 21

Assisted Solution

by:silemone
silemone earned 100 total points
ID: 33571685
you will have to direct cast the  (  object ) from  ByVal sender As Object
as the type that's being passed...and then

and then use the

Textbox text = (Textbox) object;
ID = object.id;
0
 
LVL 21

Expert Comment

by:silemone
ID: 33571694
oops...Omni is right...its actually the e.item that is the object
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 3

Expert Comment

by:omnimaven
ID: 33571734
I think you need to change the ["ID"] to ("ID"). I am used to C#.
0
 
LVL 9

Author Comment

by:TonyReba
ID: 33571897
I get the following errors, where should I place this code ? , right now is on
  Protected Sub ListView1_ItemDataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.ItemDataBound

Errors:
item' is not a member of 'System.EventArgs'.
I
["ID"]
dentifier expected.            
0
 
LVL 9

Author Comment

by:TonyReba
ID: 33572114
OK this worked changing the Sub Declaration to

Protected Sub ListView1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewItemEventArgs) Handles ListView1.ItemDataBound
0
 
LVL 9

Author Closing Comment

by:TonyReba
ID: 33572126
ty
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying 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

Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

726 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