Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

pass dataValueField in a querystring

Posted on 2006-11-18
2
Medium Priority
?
1,084 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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 …
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

636 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