locked
Html Anchor equivalent RRS feed

  • Question

  • User-538203642 posted
    Hi All, I was looking for "HtmlAnchor" control equivalent in MobileControls using asp.net. Could anyone have someidea. Thanks, Aruna.G
    Monday, November 5, 2007 5:10 AM

All replies

  • User-837620913 posted

    Check this thread out:

    http://forums.asp.net/t/1151877.aspx 

    Monday, November 5, 2007 9:04 AM
  • User-538203642 posted

     Hi,

         Thank you for your reply. My problem was with mobile:Link and mobile:ObjectList. I am trying to create links for the topics returned from the sql server after ItemDataBind. But its not creating links. It was giving "NullReferenceException". I deleted the ItemDataBind method and createda onPreRender property for Object List and its working now but not creating the links. Here is my code:

     

    protected void rptChecking_PreRender(object sender, EventArgs e)
        {
            foreach (ObjectListItem item in rptPublications.Controls)
            {
                XmlNode node = (XmlNode)item.DataItem;
                
                if (node != null)
                {
                    Link aViewTopic = (Link)item.FindControl("aViewTopic");

                    string pubId = node.Attributes["PubId"].Value;
                    string title = node.Attributes["Title"].Value;
                    string topicHeading = node.SelectSingleNode("//TopicHeading").InnerText;
                    string topicID = node.SelectSingleNode("//TopicID").InnerText;
                    string sequence = node.SelectSingleNode("//Sequence").InnerText;
                    string topicType = node.SelectSingleNode("//TopicType").InnerText;
                    bool isJournalAbout = Convert.ToBoolean(node.SelectSingleNode("//IsJournalAbout").InnerText);
                    bool isJournalWelcome = Convert.ToBoolean(node.SelectSingleNode("//IsJournalWelcome").InnerText);
                    string journalID = node.SelectSingleNode("//JournalId").InnerText;

                    string topicLink = "/topic.aspx?tid=" + topicID;
                    aViewTopic.NavigateUrl = topicLink;
                    aViewTopic.Text = topicHeading;
                        
                }
            }
        }
     
    searchResults.aspx
     
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="searchResults.aspx.cs" Inherits="searchResults" %>
     
    <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
     
     <mobile:Form Runat=server ID="Form">
        <mobile:ObjectList id="rptPublications" Runat="server" OnPreRender="rptChecking_PreRender">           
             <mobile:Link ID="aViewTopic" Runat="server"/>     
        </mobile:ObjectList>                  
    </mobile:Form>
    [Thanks, Aruna.G




     

    Monday, November 5, 2007 9:20 AM