locked
Is mobile forum alive ? RRS feed

  • Question

  • User1816754612 posted
    I keep publishing messages and getting no replies.. Here's the last one I've published, need an answer ---------------------- I am using vb.net and trying to use header, item template of the object list control I am getting error on this line <%# DataBinder.Eval(Ctype(Ctype(Container, ObjectListItem).DataItem, DataRowView), "Part") %> Error: Type 'DataRowView' is not defined What is wrong ? I have reference to the System.Data namespace but still could not make this work Thanks Mikhail
    Tuesday, December 7, 2004 11:31 AM

All replies

  • User-95607119 posted
    Ask this question in appropriate forum and you will get answered. DatBindings has nothing to do with ASP.NET mobile support.
    Wednesday, December 8, 2004 6:26 AM
  • User1816754612 posted
    I thought Object List control is a part of the Mobile Controls ! What do you mean in the appropriate forum ?
    Wednesday, December 8, 2004 2:11 PM
  • User39490543 posted
    Gunnar's point is that this question would be more appropriate in the DataGrid, DataList, Repeater Controls forum, which is specifically for the databound controls. This Mobile forum is for issues unique to developing for Mobile devices. I am disappointed and sorry that the moderation team didn't catch your question and move it to the other forum. You should consider reposting it there -- you will be more likely to receive help on this topic there. Terri
    Wednesday, December 8, 2004 2:15 PM
  • User1816754612 posted
    Yes, but object list is Mobile control ? So my question was related to mobile controls..I am developing mobile web application and not using Datagrid, Repeater ! Confused !
    Wednesday, December 8, 2004 2:33 PM
  • User39490543 posted
    It's me that's confused!! ;-) Can you tell that I don't do any Mobile development? You of course are correct. Terri
    Wednesday, December 8, 2004 2:57 PM
  • User1816754612 posted
    It's OK, finally I can tell that I've published into the correct list. Unfortunately getting no replies...I found this syntax on MS site but it does not work for me, not sure what to do.. Thanks Mikhail
    Wednesday, December 8, 2004 3:04 PM
  • User39490543 posted
    Can you post more of your code? Terri
    Wednesday, December 8, 2004 3:16 PM
  • User1816754612 posted
    Yes... Here's the html code of the form ----------------------------------------------------------------------------------------------- <mobile:form id="frmSearchResults" runat="server" Paginate="True" PagerStyle-PageLabel="Page {0} of {1}" PagerStyle-NextPageText="Next" PagerStyle-PreviousPageText="Prev"> <mobile:Label id="Label9" runat="server" StyleReference="Title">Search Results</mobile:Label> <mobile:ObjectList id="lstProducts" runat="server" ItemsPerPage="5" Font-Size="Small" BreakAfter="False" AutoGenerateFields="False"> <DeviceSpecific> <Choice Filter="isHTML32" Xmlns="http://schemas.microsoft.com/mobile/html32template"> <HeaderTemplate> </HeaderTemplate> <ItemTemplate> </ItemTemplate> <FooterTemplate>
    Part Product
    <asp:LinkButton ID="lnkPart" Runat="server"> <%# DataBinder.Eval(Ctype(Ctype(Container, ObjectListItem).DataItem, DataRowView), "Part") %> </asp:LinkButton> <asp:label ID="lblProduct" Runat="server"> <%# DataBinder.Eval(Ctype(Ctype(Container, ObjectListItem).DataItem, DataRowView), "Product") %> </asp:label>
    </FooterTemplate> </Choice> </DeviceSpecific> <Field Name="ID" Visible="False" DataField="ID"></Field> <Field Title="Item" Name="Part" Visible="True" DataField="Part"></Field> <Field Title="Product" Name="Product" Visible="True" DataField="Product"></Field> </mobile:ObjectList> </mobile:form> ----------------------------------------------------------------------------------------------------- Here's the code behind, I am using Database layer which returns Dataset (it works) 'on the previous form click on search button Private Sub Command2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Command2.Click If IsValid Then Dim SearchResults As DataSet SearchResults = Find_Products(txtPart.Text, txtKeyword.Text, Session("userid"), Session("locID")) lstProducts.DataSource = SearchResults.Tables(0).DefaultView lstProducts.DataBind() ActiveForm = frmSearchResults End If End Sub
    Wednesday, December 8, 2004 3:57 PM
  • User1037958815 posted
    mr great mvp, can u suggest where to find the answer or a statement of regret if u cannot fix the problem? don't just leave without any comments after asking for details. i've posted many and none gets answered. only got "asking for details " from mr mvp, and after that, bye2 mr mvp
    Friday, December 10, 2004 4:22 AM
  • User39490543 posted
    As I said, I am not a Mobile developer, but I went ahead and learned what I could, and took your code and played with it. Are you importing the System.Data namespace? This was my first guess as to what your problem is since that is the namespace in which DataRowView can be found. Here is a non-code behind version of your code which is working fine on my machine. I just populated a datatable using a quick loop. Everything in the body is exactly your original code. Sub Page_Load(Sender As Object, E As EventArgs) Dim dt As System.Data.DataTable Dim dr As System.Data.DataRow Dim i As Integer 'create a DataTable dt = New System.Data.DataTable dt.Columns.Add(New System.Data.DataColumn("ID", GetType(Integer))) dt.Columns.Add(New System.Data.DataColumn("Product", GetType(String))) dt.Columns.Add(New System.Data.DataColumn("Part", GetType(String))) 'Make some rows and put some sample data in For i = 1 To 9 dr = dt.NewRow() dr(0) = i dr(1) = "Product " + i.ToString() dr(2) = "Part " + i.ToString() dt.Rows.Add(dr) Next lstProducts.DataSource = dt lstProducts.DataBind End Sub </script> <mobile:form id="frmSearchResults" runat="server" Paginate="True" PagerStyle-PageLabel="Page {0} of {1}" PagerStyle-NextPageText="Next" PagerStyle-PreviousPageText="Prev"> <mobile:Label id="Label9" runat="server" StyleReference="Title">Search Results</mobile:Label> <mobile:ObjectList id="lstProducts" runat="server" ItemsPerPage="5" Font-Size="Small" BreakAfter="False" AutoGenerateFields="False"> <DeviceSpecific> <Choice Filter="isHTML32" Xmlns="http://schemas.microsoft.com/mobile/html32template"> <HeaderTemplate> </HeaderTemplate> <ItemTemplate> </ItemTemplate> <FooterTemplate>
    Part Product
    <asp:LinkButton ID="lnkPart" Runat="server"> <%# DataBinder.Eval(Ctype(Ctype(Container, ObjectListItem).DataItem, DataRowView), "Part") %> </asp:LinkButton> <asp:label ID="lblProduct" Runat="server"> <%# DataBinder.Eval(Ctype(Ctype(Container, ObjectListItem).DataItem, DataRowView), "Product") %> </asp:label>
    </FooterTemplate> </Choice> </DeviceSpecific> <Field Name="ID" Visible="False" DataField="ID"></Field> <Field Title="Item" Name="Part" Visible="True" DataField="Part"></Field> <Field Title="Product" Name="Product" Visible="True" DataField="Product"></Field> </mobile:ObjectList> </mobile:form>
    Terri aka Ms. Fair-to-Middling MVP
    Friday, December 10, 2004 8:49 AM
  • User1816754612 posted
    Thanks for playing with it Terri... Yes I have reference to System.Data namespace in my code. I don't understand why does it work on your computer and does not on mine ! Exactly the same version, almost the same code...no clue Do you have any mobile experts in mind who may help ? Thanks Mikhail
    Friday, December 10, 2004 10:16 AM
  • User39490543 posted
    Did you take my exact code and paste it into a new .aspx file and try to look at that page inside of your browser? What results did you get? Note that the only other thing I had to do was add a deviceFilters block into my Web.Config <deviceFilters> <filter name="isHTML32" compare="PreferredRenderingType" argument="html32" /> <filter name="isWML11" compare="PreferredRenderingType" argument="wml11" /> <filter name="isPocketIE" compare="Browser" argument="Pocket IE" /> <filter name="isUP3x" compare="Type" argument="Phone.com 3.x Browser" /> <filter name="isEricssonR380" compare="Type" argument="Ericsson R380" /> <filter name="prefersGIF" compare="PreferredImageMIME" argument="image/gif" /> <filter name="supportsJavaScript" compare="Javascript" argument="true" /> </deviceFilters> Terri
    Friday, December 10, 2004 10:24 AM
  • User1816754612 posted
    I've decided to get rid of this line <DeviceSpecific> <Choice Filter="isHTML32" Xmlns="http://schemas.microsoft.com/mobile/html32template"> and now I am getting different error Value of type 'System.Web.UI.MobileControls.ObjectList' cannot be converted to 'System.Web.UI.MobileControls.ObjectListItem'. on the same line... What is interesting the build goes fine and then browser shows the error on the first page of the application ! Why ? Mikhail
    Friday, December 10, 2004 10:39 AM
  • User1816754612 posted
    I am also getting error Type 'DataRowView' is not defined with your code... Any ideas ?
    Friday, December 10, 2004 11:04 AM
  • User39490543 posted
    It would have helped if I had included the top 3 lines of my code...SORRY! Here's the COMPLETE code <%@ Page Language="vb" Inherits="System.Web.UI.MobileControls.MobilePage" %> <%@ import Namespace="System.Data" %> <script runat="server"> Sub Page_Load(Sender As Object, E As EventArgs) Dim dt As System.Data.DataTable Dim dr As System.Data.DataRow Dim i As Integer 'create a DataTable dt = New System.Data.DataTable dt.Columns.Add(New System.Data.DataColumn("ID", GetType(Integer))) dt.Columns.Add(New System.Data.DataColumn("Product", GetType(String))) dt.Columns.Add(New System.Data.DataColumn("Part", GetType(String))) 'Make some rows and put some sample data in For i = 1 To 9 dr = dt.NewRow() dr(0) = i dr(1) = "Product " + i.ToString() dr(2) = "Part " + i.ToString() dt.Rows.Add(dr) Next lstProducts.DataSource = dt lstProducts.DataBind End Sub </script> <mobile:form id="frmSearchResults" runat="server" Paginate="True" PagerStyle-PageLabel="Page {0} of {1}" PagerStyle-NextPageText="Next" PagerStyle-PreviousPageText="Prev"> <mobile:Label id="Label9" runat="server" StyleReference="Title">Search Results</mobile:Label> <mobile:ObjectList id="lstProducts" runat="server" ItemsPerPage="5" Font-Size="Small" BreakAfter="False" AutoGenerateFields="False"> <DeviceSpecific> <Choice Filter="isHTML32" Xmlns="http://schemas.microsoft.com/mobile/html32template"> <HeaderTemplate> </HeaderTemplate> <ItemTemplate> </ItemTemplate> <FooterTemplate>
    Part Product
    <asp:LinkButton ID="lnkPart" Runat="server"> <%# DataBinder.Eval(Ctype(Ctype(Container, ObjectListItem).DataItem, DataRowView), "Part") %> </asp:LinkButton> <asp:label ID="lblProduct" Runat="server"> <%# DataBinder.Eval(Ctype(Ctype(Container, ObjectListItem).DataItem, DataRowView), "Product") %> </asp:label>
    </FooterTemplate> </Choice> </DeviceSpecific> <Field Name="ID" Visible="False" DataField="ID"></Field> <Field Title="Item" Name="Part" Visible="True" DataField="Part"></Field> <Field Title="Product" Name="Product" Visible="True" DataField="Product"></Field> </mobile:ObjectList> </mobile:form>
    Terri
    Friday, December 10, 2004 11:30 AM
  • User1816754612 posted
    Yes, now your example works fine... May be this is smth to do with code behind versus the inline code in 1 file like you did it. BTW I am so used to do it in code behind that don't know how to do it without it Can you try it with code behind ? Mikhail
    Friday, December 10, 2004 11:37 AM
  • User39490543 posted
    I'll be happy to try it with code behind -- can you provide both of your files? Either post them here or email to the address in my profile. Terri
    Friday, December 10, 2004 11:49 AM
  • User1816754612 posted
    Can you try it with your code just with code behind ? My applications has more then 10 separate forms and would have a lot of code you don't need...
    Friday, December 10, 2004 12:06 PM
  • User39490543 posted
    OK, you'll be pleased to know that I experienced the same error. To get around it, I preceded DataRowView with System.Data. and then all worked well. E.g.: <%# DataBinder.Eval(Ctype(Ctype(Container, ObjectListItem).DataItem, System.Data.DataRowView), "Part") %> Terri
    Friday, December 10, 2004 12:35 PM
  • User1816754612 posted
    I personally think that this is a bug, do you agree ? I've added to my code behind Imports System.Data but it was not used, why ? Now it is working BTW Do you mind if I start exchanging messages with you using your email ? Thank Mikhail
    Friday, December 10, 2004 1:03 PM
  • User39490543 posted
    I don't think it's so much a bug as it is "that's just the way it works". The .aspx file is compiled first, and separately, from the .vb file. It doesn't know anything about what the .vb file is doing. Another solution in your case would be to add this to the top of the .aspx page (just as in my original example): <%@ import Namespace="System.Data" %> I found this article which might be useful: Behind the scenes of ASPX files I'd prefer communicating on the Forums directly so that we can all learn together. Terri
    Friday, December 10, 2004 1:54 PM
  • User1816754612 posted
    Thanks for the link... <%@ import Namespace="System.Data" %> I've also tried adding this line to my aspx page and it id not help... Strange ! Mikhail
    Friday, December 10, 2004 1:58 PM