[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

pass dataValueField in a querystring

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
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…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month19 days, 6 hours left to enroll

834 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