Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Mobile / March 2006

Tip: Looking for answers? Try searching our database.

Images in Search Results?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dvkintanar@gmail.com - 26 Mar 2006 20:33 GMT
Hi, I'm trying to write a simple mobile search site that has thumbnails
in the search results.  I've tried building the search results using
several different mobile controls, but I haven't had any success so
far.

The  <mobile:Label> uses html codes for all of the special characters,
so my image tags get printed out instead of showing the image.

The <mobile:TextView> just ignores image tags.

I've tried a couple other, but basically nothings worked for me thus
far.

Could anyone help me out here?  I just need a way to build the search
results html so that the image tags (and others) get recognized and
rendered correctly.

Thanks,
Dustin
kapilp - 29 Mar 2006 21:21 GMT
I had a similar issue and I had to create an custom control to do this. Here
is the code for it. look it over. it works.

public partial class SearchResults :
System.Web.UI.MobileControls.MobileUserControl
{
   private DataTable mSearchData = null;
   private int mTotalFound = 0;

   public DataTable SearchData
   {
       get
       {
           return this.mSearchData;
       }
       set
       {
           this.mSearchData = value;
       }
   }

   public int TotalFound
   {
       get
       {
           return this.mTotalFound;
       }
       set
       {
           this.mTotalFound = value;
       }
   }

   public override void DataBind()
   {
       if (this.mSearchData != null)
       {
           if (this.mSearchData.Rows.Count > 0)
           {
               this.lblResultCount.Text = this.mTotalFound.ToString() + "
flingers found.";
               this.lblDisplayedCount.Text =
this.mSearchData.Rows.Count.ToString() + " displayed.";
               for (int i = 0; i < this.mSearchData.Rows.Count; i++)
               {
                   // setup some needed variables
                   string ImageID =
this.mSearchData.Rows[i]["ImageID"].ToString();
                   string iVal = i.ToString();
                   string ProfileID =
this.mSearchData.Rows[i]["ProfileID"].ToString();
                   // if there is an image to show the add the image control
                   if (!String.IsNullOrEmpty(ImageID))
                   {
                       SqlImage MyImage = new SqlImage();
                       MyImage.ID = "SqlImage" + iVal;
                       MyImage.ImageID = Convert.ToInt32(ImageID);
                       MyImage.EnableCaching = true;
                       MyImage.CacheDuration = 120;
                       this.Controls.Add(MyImage);
                   }
                   // setup the screen name label
                   System.Web.UI.MobileControls.Label lblScreenName = new
System.Web.UI.MobileControls.Label();
                   lblScreenName.ID = "lblScreenName" + iVal;
                   lblScreenName.StyleReference = "Label";
                   lblScreenName.Text =
this.mSearchData.Rows[i]["ScreenName"].ToString();
                   this.Controls.Add(lblScreenName);
                   // setup the information label
                   System.Web.UI.MobileControls.Label lblInfo = new
System.Web.UI.MobileControls.Label();
                   lblInfo.ID = "lblInfo" + iVal;
                   lblInfo.StyleReference = "Label";
                   lblInfo.Text =
this.mSearchData.Rows[i]["Age"].ToString() + " - " +
this.mSearchData.Rows[i]["Gender"].ToString() + " - " +
this.mSearchData.Rows[i]["CityProvince"].ToString() + ", " +
this.mSearchData.Rows[i]["StateCode"].ToString();
                   this.Controls.Add(lblInfo);
                   // setup the view profile link
                   System.Web.UI.MobileControls.Link lnkProfile = new
System.Web.UI.MobileControls.Link();
                   lnkProfile.ID = "lnkProfile" + i.ToString();
                   lnkProfile.StyleReference = "Link";
                   lnkProfile.Text = "View Profile";
                   lnkProfile.NavigateUrl =
"~/Unauthenticated/ViewProfile.aspx?ProfileID=" +
this.mSearchData.Rows[i]["ProfileID"].ToString();
                   this.Controls.Add(lnkProfile);
                   if (i < this.mSearchData.Rows.Count - 1)
                   {
                       System.Web.UI.MobileControls.Image Line = new
System.Web.UI.MobileControls.Image();
                       Line.ID = "imgLine" + iVal;
                       Line.ImageUrl = "~/Images/BlackLine.jpg";
                       this.Controls.Add(Line);
                   }
               }
           }
           else
           {
               this.lblResultCount.Text = "No flings found.";
               this.lblDisplayedCount.Visible = false;
           }
       }
       else
       {
           this.lblResultCount.Text = "No flings found.";
           this.lblDisplayedCount.Visible = false;
       }
   }
}

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.