?
Solved

pass dataValueField in a querystring

Posted on 2006-11-18
2
Medium Priority
?
1,081 Views
Last Modified: 2010-05-18
How do I pass the DataValueField in a bulleted list via a QueryString to my details page, EmploymentDetails.aspx, so I can display all the data.

Here is my method in the data access object class file that returns the records from the database:

public static ArrayList GetList()
        {
            ArrayList a = new ArrayList();
            try
            {

                // Create DataBase Instance
                Database db = DatabaseFactory.CreateDatabase("conn");
                DbCommand dbCommand = db.GetStoredProcCommand("dbo.spGetEmploymentOpportunities");
                using (IDataReader dataReader = db.ExecuteReader(dbCommand))
                {
                    while (dataReader.Read())
                    {
                        EmploymentOpportunity e = new EmploymentOpportunity();
                        e.ID = (int)dataReader["employment_opportunity_id"];
                        e.title = dataReader["title"].ToString();
                        e.location1 = dataReader["location"].ToString();
                        e.responsabilities = dataReader["responsibilities"].ToString();
                        e.physicalRequirements = dataReader["education_experience"].ToString();
                        e.educationExperience = dataReader["physical_requirements"].ToString();
                        e.salary = dataReader["salary_info"].ToString();
                        e.contactEmail = dataReader["contact_email"].ToString();
                       
                        a.Add(e);
                    }
                }
            }
            catch (Exception ex)
            {
                //Response.Write(ex.ToString());
            }
            return a;
        }

Here is my bulleted list control:

<asp:BulletedList ID="BulletedList1" runat="server" CssClass="ulnobullets" DisplayMode="HyperLink">
    </asp:BulletedList>

Here is the page load method in the code-behind:

protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {  
            BulletedList1.DataSource = EmploymentOpportunityDAO.GetList();
            BulletedList1.DataValueField = "ID";
            BulletedList1.DataTextField = "title";
            BulletedList1.DataBind();
        }
    }

I need to set this line to pass the value via a querystring.  How do I accomplish this?

BulletedList1.DataValueField = "ID";


Any help is appreciated.
Thanks.
0
Comment
Question by:-Dman100-
[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
2 Comments
 
LVL 9

Accepted Solution

by:
kraffay earned 2000 total points
ID: 17973024
Are you asking how to get the selected value of the bulleted list talked on to a qry string?

If so, there is selectedIndex_changed (check me on that) event of the list that fires when a user makes a selection.  You can have your list auto-post back and then grab the selectedValue property of the list, then redirect to a url that you build dynamically.

protected void mylist_selectedindex_changed(yada...yada)
{

      string ID = mylist.selectedvalue;
      response.redirect("EmploymentDetails.aspx?ID=" + ID);  

}


0
 

Author Comment

by:-Dman100-
ID: 17973087
Hi kraffy,

Thanks for replying to my post.

Yes, I do want to pass the selected value of the bulleted list in a querystring.

I checked the events for the bulleted list, but there isn't a selectedIndex_changed event.  I believe that is an event for a dropdown control.

I thought I could build the querystring using:

BulletedList1.DataValueField = "EmploymentDetails.aspx?ID=" + ID;

But, that doesn't work.
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

762 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