Tips on data binding with mobile Web applications

Some tips on data binding with mobile applications in ASP.NET:

 

  • When using databinding with a SelectionList control in a mobile Web application, you must remember to set its DataValueField or DataTextField (any of the two), failing which binding may not occur. This is an important point to note because in this case when the binding fails, there is no error raised. So there’s no way you can know why the binding did not occur. Hence, always ensure that one out of these fields have been set at design time or within code before proceeding to further logic.
  • The ObjectList control in mobile Web applications does not have inbuilt data manipulation support. You need to manually write code for that.
  • The SelectionIndexChanged event of SelectionList control does not get raised unless a PostBack is done. To get a workaround for this, what you can do is: use a Command control and create a Click event handler for it (even if you don’t have any action, just create an empty event handler) to generate the Postback.