Solved

pass dataValueField in a querystring

Posted on 2006-11-18
2
1,076 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 500 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

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

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

717 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