Can't retrieve selected text/value of SelectionList after submit - URGENT

Discussion in 'ASP .Net Mobile' started by domchik, Sep 3, 2003.

  1. domchik

    domchik Guest

    I'm unable to retrieve selected text/value of SelectionList after
    submit. Please take a look at the whole page. The problematic line is
    inside
    go_Click event . Please help !!! - I'm stuck with it for 3 days
    already .

    Thank You!!!


    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Data.SqlClient;
    using System.Drawing;
    using System.Web;
    using System.Web.Mobile;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.MobileControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;

    namespace mclient1
    {
    /// <summary>
    /// Summary description for MobileWebForm1.
    /// </summary>
    public class MobileWebForm1 : System.Web.UI.MobileControls.MobilePage
    {
    protected System.Web.UI.MobileControls.Form OriginPoint;
    protected System.Web.UI.MobileControls.Label Label1;
    protected System.Web.UI.MobileControls.Command go;
    protected System.Web.UI.MobileControls.SelectionList cboCities;
    protected System.Web.UI.MobileControls.TextBox street;


    private string cityName="";
    private string streetName = "";
    private void Page_Load(object sender, System.EventArgs e)
    {

    if (!IsPostBack)
    {
    db Cities = new db((string)Application["connstr"]);
    Cities.getProcName ="sp_select_cities";
    SqlDataReader drCities = Cities.dr_select_cities() ;
    string _text ="";
    string _value ="";
    while (drCities.Read())

    {
    _text = drCities["CityName"].ToString();
    _value = drCities["CityID"].ToString();
    cboCities.Items.Add(new MobileListItem( "ten" ,"10"));

    }
    }


    }

    #region Web Form Designer generated code
    override protected void OnInit(EventArgs e)
    {
    //
    // CODEGEN: This call is required by the ASP.NET Web Form Designer.
    //
    InitializeComponent();
    base.OnInit(e);
    }

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
    this.cboCities.SelectedIndexChanged += new
    System.EventHandler(this.SelectedIndexChanged);
    this.go.Click += new System.EventHandler(this.go_Click);
    this.Load += new System.EventHandler(this.Page_Load);

    }
    #endregion

    private void go_Click(object sender, System.EventArgs e)
    {


    *** AT THIS POINT cboCities.Selection IS NULL AND
    cboCities.SelectedIndex = - 1****
    cityName = cboCities.Selection.Value;

    }

    private void SelectedIndexChanged(object sender, System.EventArgs e)
    {

    }
    }
    }
    domchik, Sep 3, 2003
    #1
    1. Advertising

  2. domchik

    domchik Guest

    even when I add listItems menually like this :

    cboCities.Items.Add(new MobileListItem ( "ten" ,"10"));

    without using of values that come from stored procedure , I'm still
    can't do this !!! i mean cboCities.Selection = null inside the
    go_click event . It's driving me mad ! The WML is generated by VS.NET
    .. I don't see anything wrong in it . Do you have any other ideas ?
    Thanks a lot for the assistance !
    domchik, Sep 4, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. nLL
    Replies:
    3
    Views:
    562
    Bart Tubalinal
    Jan 28, 2009
  2. hawkzen

    SelectionList can't view correctly on openwave

    hawkzen, Dec 26, 2003, in forum: ASP .Net Mobile
    Replies:
    0
    Views:
    109
    hawkzen
    Dec 26, 2003
  3. hawkzen
    Replies:
    0
    Views:
    121
    hawkzen
    Dec 26, 2003
  4. Mark Gialo

    Selectionlist - How to Change the Initial Value

    Mark Gialo, Nov 21, 2006, in forum: ASP .Net Mobile
    Replies:
    1
    Views:
    678
  5. SK
    Replies:
    1
    Views:
    808
Loading...

Share This Page