Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Mobile > Images in Search Results?

Reply
Thread Tools

Images in Search Results?

 
 
dvkintanar@gmail.com
Guest
Posts: n/a
 
      03-26-2006
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

 
Reply With Quote
 
 
 
 
kapilp
Guest
Posts: n/a
 
      03-29-2006
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;
}
}
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataList with RadioButtons + Images: How to click on the images to activate the radiobutton? Luis Esteban Valencia Muņoz ASP .Net 0 06-03-2005 03:22 PM
Track Images added to images folder and subfolders - send out email alerts ASP .Net 4 01-04-2005 10:01 PM
search within a search within a search - looking for better way...my script times out Abby Lee ASP General 5 08-02-2004 04:01 PM
Can recover old images from SmartMedia card, but not recent images Stephen Stormont Digital Photography 9 10-20-2003 07:59 PM



Advertisments