?
Solved

dynamic binding listview asp.net 3.5

Posted on 2010-08-31
7
Medium Priority
?
518 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 1600 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 400 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
WordPress Tutorial 3: Plugins, Themes, and Widgets

The three most common changes you will make to your website involve the look (themes), the functionality (plugins), and modular elements (widgets).

In this article we will briefly define each again, and give you directions on how to install them.

 
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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Suggested Courses

771 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