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