how to create hyperlinks in object list RRS feed

  • Question

  • User-820174969 posted
    i'm creating a mobile application that connects to a database.
    the first form will display results from a relativley simple select query.
    i bound the reults in an objectlist.
    the problem is that i need to make the results as hyperlinks.
    each link will execute an sql command.
    example: if the results in the first form look like this:
    When i press on A, the following command will be executed:
    Select * from course where grade = A
    When i press on B, the following command will be executed:
    Select * from course where grade = B
    and so on.
    So if you can help on how to create hyperlinks and how to get data from an objectlist i will be more than thanksfull.
    Wednesday, August 3, 2005 7:19 AM

All replies

  • User286710293 posted

    User InterFace Code
    <mobile:Form id="Form1" runat="server">
      <mobile:ObjectList id="ObjectList1" runat="server" CommandStyle-StyleReference="subcommand" LabelStyle-StyleReference="title"
       AutoGenerateFields="False" LabelField="id" TableFields="letter_" BackCommandText="Back" DetailsCommandText="Details"
       MoreText="More" DefaultCommand="item_click">
       <Command Name="item_click" Text="item_click"></Command>
       <Field Title="id" Name="id" DataField="id"></Field>
       <Field Title="letter_" Name="letter_" DataField="letter_"></Field>
       <Field Title="other_" Name="other_" DataField="other_"></Field>
     <mobile:Form id="Form2" runat="server">
         <mobile:TextView id="TextView1" runat="server">TextView</mobile:TextView>

    Behiend Code
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            If Not IsPostBack Then
            End If
        End Sub

        Sub ObjectList1_bind()

            ObjectList1.DataSource = get_dataset("select * from lessons", "lessons").tables("lessons").defaultview

        End Sub

        Function get_dataset(ByVal strsql As String, ByVal tablename As String)

            Dim dsn As String = "provider=microsoft.jet.oledb.4.0;data source=" & Server.MapPath("6%3(.mdb")
            Dim conn As OleDbConnection = New OleDbConnection(dsn)
            Dim my_ad As OleDbDataAdapter = New OleDbDataAdapter(strsql, conn)
            Dim my_ds As New DataSet
            my_ad.Fill(my_ds, tablename)
            Return my_ds

        End Function

        Private Sub ObjectList1_ItemCommand(ByVal sender As Object, ByVal e As System.Web.UI.MobileControls.ObjectListCommandEventArgs) Handles ObjectList1.ItemCommand
            Select Case e.CommandName
                Case "item_click"
                    ActiveForm = Form2
                    Dim strsql As String = "Select * from lessons where letter_ ='" & e.ListItem.Item("letter_").ToString & "'"
                    Dim tablename As String = "lessons"
                    Dim my_new_dataset As DataSet = get_dataset(strsql, tablename)
                    TextView1.Text = my_new_dataset.Tables("lessons").Rows(0).Item("id") & "<br>" & my_new_dataset.Tables("lessons").Rows(0).Item("letter_") & "<br>" & my_new_dataset.Tables("lessons").Rows(0).Item("other_")
            End Select

    DataBase Name      6%3(.mdb
    TableName        lessons
    FieldName         id   ,  letter_,  other_  

    Thursday, August 4, 2005 1:30 AM
  • User2085740027 posted
    Here is a piece of code that will help u..

    <mobile:ObjectList id="MenuList" runat="server" Alignment="Center" 
    ItemCount="300" TableFields="rauctionid" LabelField="& -
    rauctionid" stylereference="FormText">

    <Choice xmlns="Mobile HTML3.2 Template" Filter="isHTML32">
    <tr bgcolor="#CF325E">
    <td width="40%" bgcolor="#FFFFFF">Product Name</td>
    <td><%# Ctype(Container,  ObjectListItem)("productname") %></td>

    <td>Starting Bid</td>
    <td><%# Ctype(Container,  ObjectListItem)("AmountFrom") %></td>

    <td>Close Date</td>
    <td><%# Ctype(Container,  ObjectListItem)("ClosingDate") %></td>

    <td>Your Bid</td>
    <td><input type="Hidden" size="10" name="& -
    HidRAID" id="HidRAID" alignment="Left"& -
    Value="<%# Ctype(Container, ObjectListItem)("rauctionid") %>" />
    <input type="text" size="10" name="objtext" & -
    id="objText" alignment="Left" /></td>

    <td> &nbsp;</td>
    <td><asp:LinkButton runat="server" ID="Linkbutton1">& -


    <Choice xmlns="Mobile cHTML Template" Filter="isWML11">
    Product Name
    <%# Ctype(Container, ObjectListItem)("productname") %>

    Min Bid
    <%# Ctype(Container,  ObjectListItem)("AmountFrom") %>

    Bid Closing Date
    <%# Ctype(Container,  ObjectListItem)("ClosingDate") %>

    Your Bid
    <input type="text" name="txtAmount" format="*N" />

           Your Bid
           <go method="post" href="wapprodDetail.aspx">
           <postfield name="Bid" value="yes" />
           <postfield name="txtAmount" value="$(txtAmount)" />
           <postfield name="RAID" value="<%# & -
       Ctype(Container, ObjectListItem)("RAuctionId") %>" />


    Friday, August 5, 2005 5:46 PM