Solved

dynamic binding listview asp.net 3.5

Posted on 2010-08-31
7
514 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
Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

 
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

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

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

This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
The viewer will learn how to dynamically set the form action using jQuery.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

688 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