views:

74

answers:

1

Hi, I am trying to develop the single page in asp.net web mobile application as code behind c#. I have took the Mobile select list control on page.It has items, 1,2,3,4,5,6,7,8...20. I want it should be assign the selected value of select control to mobile label control situated on page (Mobile Form). As per i know I have to code this on OnSelectIndexChanged Event at code behind. ok? but nothing like this happening. I have written the method (Event) on code behind. I don't want to write javscript or on .aspx code ( not want any client code). I want to conduct functionality on code behind. How should I can achieve this.? As I found Select List control of Mobile toolkit not generates the server side event.

What I have to do?

+2  A: 

You need to set AutoPostBack=true in your select list control in order to fire the OnSelectedIndexChanged event.

EDIT:

In looking on Google for 30 seconds, I discovered that a selection of an item in the SelectionList does not fire a server event.

Look at the MSDN documentation for a sample on how to raise a server response.

TheGeekYouNeed
But there is no such property to select List controls in mobile toolkit.
Lalit
ok but what to do then i i want to use dropdown control ?
Lalit
There is a property of the SelectionList that lets you indicate that it will be a DropDownList
TheGeekYouNeed
anyway..i solved this by using DeviceSpecific :ASPX Code: <code> <mobile:Panel ID="Panel1" Runat="server"></code><mobile:DeviceSpecific ID="DeviceSpecific1" Runat="server"><Choice Filter="supportsJavaScript"><ContentTemplate></ContentTemplate></Choice> </mobile:DeviceSpecific></mobile:Panel>
Lalit
Code Behind:DropDownList selectList = new DropDownList();if (selectList != null){ selectList.ID = "selectionList" + j; selectList.AutoPostBack = true;selectList.SelectedIndexChanged += new EventHandler(selectList_SelectedIndexChanged);for (int k = 0; k < count; k++){selectList.Items.Add("Item :" + k.ToString());}Panel1.Content.Controls.Add(selectList);}
Lalit