Asked by:
SelectionList_SelectedIndexChanged not work?

Question
-
User-886611103 posted
<mobile:SelectionList id="LAop" runat="server" SelectType="Radio"> <Item Value="L" Text="Late" Selected="True"></Item> <Item Value="A" Text="Absent"></Item> </mobile:SelectionList> SeletionList_SelectedIndexChanged event is not raised while I checked any radio option why?Sunday, February 16, 2003 3:05 PM
All replies
-
User1341174311 posted
You need to put a button on your form to do the postback. AFAIK, many mobile controls do not have an autopostback property like webform controls do. However, the event handler should still run for the selection_changed event.Tuesday, February 18, 2003 9:54 AM -
User303339568 posted
Jamie is correct. This event will fire only after a Command control has posted back to the server. - AnilTuesday, February 18, 2003 7:56 PM -
User-886611103 posted
that means I have to use command_Clicked?Tuesday, February 18, 2003 9:00 PM -
User-886611103 posted
Sorry, I don't still not so understand, what is meant by "This event will fire only after a Command control has posted back to the server"?? what else I should add to the form to make SelectionLIst_SelectedIndexChanged to work??Tuesday, February 18, 2003 9:03 PM -
User303339568 posted
Use a <Mobile:Command> control which will allow you to post back to the server. - AnilTuesday, February 18, 2003 9:15 PM -
User1341174311 posted
Ad a button to the form. When the user selects an option and then clicks the button (or presses the associated softkey on a mobile device) the page will postback to the server, the event handlers will execute for the button and the SelectionList. ;)Tuesday, February 18, 2003 9:16 PM -
User1341174311 posted
Anil, great website. Is it based on the portal?Tuesday, February 18, 2003 9:17 PM -
User-886611103 posted
that means I can't display different results by choosing options in selection list without postback to server, SelectionList_SelectedIndexChanged is no use then.Tuesday, February 18, 2003 9:28 PM -
User303339568 posted
Thanks Jamie. Glad you like it. No. It is not based on the portal. I am a bit of a usability nut so it is all homegrown :-) - AnilTuesday, February 18, 2003 9:29 PM -
User-385102369 posted
Hi Natalie- Yes you can display different results based on the options selected in the list, however, the server needs to be notified through events. SInce the 'SelectionList' control doesn't support 'AutoPostBack' event , that notification occurs by providing another control (in this case Command) which does support 'AutoPostBack'.Wednesday, February 19, 2003 2:59 PM -
User-13463694 posted
Hi, I have one additional note. Autopostback functionality for a dropdown list requires javascript. If you want to support an autopostback experience on HTML devices that have javascript, you can use the desktop ASP.Net dropdown list in a device specific content template. See this KB article for an example. http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b308975Wednesday, February 19, 2003 4:03 PM -
User-1546193688 posted
hi... i use the codes from the given address, and now i cant set the selectionList's Datasource to Reader as below: SltListSignInPerson.DataSource = objReader1 the error said that the SltListSignInPerson is not declare..... can any1 here show me the way to set the DataSource of it...? pls.... here is my xhtml codes... <mobile:Panel id="Panel2" runat="server"> <mobile:DeviceSpecific id="DeviceSpecific2" runat="server"> <Choice filter="supportsJavaScript"> <ContentTemplate> <asp:DropDownList id="SltListSignInPerson" runat="server" Alignment="Center" OnSelectedIndexChanged="SltListSignInPerson_SelectedIndexChanged" datatextfield="Name" AutoPostBack="True"></asp:DropDownList> </ContentTemplate> </Choice> <Choice> <ContentTemplate> <Mobile:SelectionList id="SltListSignInPerson" runat="server" Alignment="Center" datatextfield="Name" OnSelectedIndexChanged="SltListSignInPerson_SelectedIndexChanged"></Mobile:SelectionList> <mobile:Command runat="server" text="yoyo" /> </ContentTemplate> </Choice> </mobile:DeviceSpecific> </mobile:Panel>Tuesday, September 23, 2003 2:44 AM -
User-13463694 posted
Since the dropdown list is in a content template, you have to use FindControl to get a reference.Panel.Content.FindControl(controlId)
Hope this helps.Tuesday, September 23, 2003 2:15 PM -
User-1546193688 posted
hi, thanks for the codes! but it show me this error Compiler Error Message: BC30456: 'DataSource' is not a member of 'System.Web.UI.Control'. error sourcePanel2.Content.FindControl("SltListSignInPerson").DataSource=objReader '================================ and i tried to use this codes if (Panel2.Content.FindControl("SltListSignInPerson") != null) ((System.Web.UI.WebControls.DropDownList)Panel2.Content.FindControl("SltListSignInPerson")).DataSource = objReader error ms: Value of type 'System.Web.UI.Control' cannot be converted to 'Boolean'. error line: if (Panel2.Content.FindControl("SltListSignInPerson") != null) is there anything i've done wrongly...? Regards life's NgThursday, September 25, 2003 9:18 PM -
User-13463694 posted
Your compiler error is from the VB compiler, but your code is C#. Use the language=cs attribute on your<script runat=server language=cs>
element. Don't forget the semicolon in the line where you are setting your DataSource.Friday, September 26, 2003 3:51 PM -
User-1546193688 posted
huh... would u provide me the codes in VB? coz im using VB from starting.... best regards life's NgSaturday, September 27, 2003 12:36 AM -
User-13463694 posted
I think you'll need to look at a VB book or some introductory documentation to get examples of syntax, such as comparing to null ("Nothing"), negating a boolean expression, and casting. Comparing to null ("Nothing" in vb):If x Is Nothing Then
Negating the comparison:If Not (x Is Nothing) Then
Casting (CType keyword):Dim myButton As Button = CType(e.Item.FindControl("myButton"), Button)
There are lots of examples on MSDN of this sort of thing, and an introductory VB book will teach this syntax. For example, I used this MSDN article as a reference for the examples above, since I don't code often in VB.Friday, October 10, 2003 4:47 PM -
User-1546193688 posted
thanks Mr. Scottim! Best Regards life's NgFriday, October 10, 2003 8:36 PM -
User-1208438202 posted
Hi
I am also having a problem with selectionlist control, which automatically shows a border in Mobile(Sony Ericsson-P910i) and shown as dropdown list in Nokia(3250).. but it is working fine in IE browser..
can anyone help me to sort this problem..
thanks in advance
Wednesday, August 30, 2006 2:37 AM