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

D

domchik

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)
{

}
}
}
 
D

domchik

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 !
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top