how to bind an thumbnail image in repeater control - asp.net

I have an requirement where in my datatable.
I have 3 columns.
serverpath,image name, id
Now I need to get the imagepath from that the datatable[serverpath] and bind it in a repeater control or gridview control and show the thumbnail images there. Actaully in the path d:/application/images folder I have images.
When I bind to repeater control or grid control I need to convert the orignal images into thumbnail and display in reater control. In (5x5) rows x columns but I need to show only thumbnail images no other details like[server path,id].
ex:
thumailimge1 thumailimge2 thumailimge3 thumailimge4 thumailimge5
thumailimge6 thumailimge7 thumailimge8 thumailimge9 thumailimge10
so once the user click on this thumbnail orignal image will be displayed in a new window
hope my question is clear...
how can I achieve this functionality?
any help would be greatly appreciated

You could write a custom asp.net handler (or even a plain aspx page where you manually write to the Response) to serve the image as the source for an img tag in your repeater
ASHX:
http://www.codeproject.com/KB/aspnet/CustomImageHandler.aspx
http://dotnetperls.com/ashx-handler
ASPX:
http://weblogs.asp.net/whaggard/archive/2003/03/23/4180.aspx
http://www.devx.com/vb2themax/Tip/19463

Related

Copy images from imagefield

I currently have a pdf that contains imagefields.
The issue however is that we want to be able to copy the images users input into the pdf.
Is there a way to alter the imagefield or add a button to the form that will copy the image so it will be available for pasting?
I see that I can put a button on the page and via script access the value for ImageField1.value so I can set it. But how can I read it?
you can access the image data by ".rawValue" attribute.
For example with a button and "click" event.
FormCalc: $.parent.sPic.rawValue = $.parent.dPic.rawValue
JavScript: xfa.resolveNode("sPic").rawValue = xfa.resolveNode("dPic").rawValue
with dPic being imagefield and sPic being image. This script will copy the image from imagefield into the image.

Cannot edit images inside sitecore field renderer

I have used Sitecore field renderer for one of my page to be edited in the Sitecore page editor. That page includes an image which needs to be reference from Sitecore media library.
So I insert the image control into the markup of the Sitecore field renderer as follows
<img id="imgBusinessAdFeatues" class="classifiedImageSamples" src="~/media/Images/What is a Business Account/businessAdFeatures.ashx" alt="Business Ad with Features" />
“~/media/Images/What is a Business Account/businessAdFeatures.ashx” is the path to the image that stored in Sitecore media folder.
Now the image is rendered properly inside the page, but when I tried to edit that image (upload a new image) using Sitecore page editor it’s not allow me.
Is there any way to make the image editable (Upload a new image) when I open that page in Sitecore page editor?
Thanks
Thank you for the ideas.
But my problem is little bit different. I have Sitecore field renderer in in my sample page.
<sc:FieldRenderer ID="frTestPage" runat="server" />
From the code behind on that page, I bind a Sitecore item as follows.
frTestPage.Item = DatabaseManager.MasterDatabase.GetItem(“itemID1”);
frTestPage.FieldName = "Content";
In the item that I’m binding to the field renderer, it has richtextbox field name “Content”.
Within that “Content” field I have inserted my markup to be render to the page. So that markup consist of following img tag and other relevant HTML.
<img id="imgBusinessAdFeatues" class="classifiedImageSamples" src="~/media/Images/What is a Business Account/businessAdFeatures.ashx" alt="Business Ad with Features" />
So how can I give the image src path correctly which reference to an image in Sitecore media library.
It's wrong to use hardcoded path for images:
You can see all parameters here.
If you use XSLT to render your images, you can apply the parameters on the sc:image directly:
<sc:image field="MyImage" width="150" height="100" bc="ffffff"/>
If you use UserControls (.ascx) to render your images, you can register the following tagprefix to access sc:Image and sc:FieldRenderer:
<%# Register TagPrefix="sc" Namespace="Sitecore.Web.UI.WebControls" Assembly="Sitecore.Kernel" %>
You can use Edit(Page Editor), then More -> Insert Image, see:
Also, to have a more edit options you can use "Edit e related Item"

Facebook like button is not displaying if the href has a dynamic component asp.net

I have a asp.net page with a repeater list on it containing Facebook like buttons.
The like buttons render ok in the repeater items if the href on all the like buttons are the same in all of the items, but if I place a query string component in the href it will only show the last item in the repeater.
e.g. the URL that will render the controls properly http://www.mysite.com/asppage.aspx
but putting querystring component http://www.mysite.com/asppage.aspx?querystring=uniqueID where unique id is unique number in each repeater list item
I have followed all of the facebook guides but nothing fixed this issue
I’m using the HTML5 version of the facebook like button
lblFaceBookLikeButton.Text = "<div class='fb-like' data-href='http://www.mysite.com/asppage.aspx?querystring=uniqueID ' data-send='true' data-width='450' data-show-faces='true'></div>";
any ideas?
Place a & symbol at the end of the queryString fixes this issue

How to assign Bitmap to ImageControl

I am trying to bind image to image control, but image is bitmap data. How can I?
Do you mean that you have an image as binary data and you want to display it without saving it in a file? If yes, then one solution will be to create a separate aspx page or an http handler to return the image. You need to set the content type and length accordingly and use Response.BinaryWrite for serving the image.
See here for some more suggestions.

creating help for asp.net website

My requirement is to have database based help system for asp.net website, as shown in the image below. i have searched web but could not find even remotely related solution.
DNN Help System http://img3.imageshack.us/img3/6720/dnnhelpimage20091125.jpg
You could assign each help item a unique ID (perhaps GUID to make it easier to generate by the developer enabling help for that item).
Clicking on the link opens a dialog, tooltip, new window, whatever. Just have the UI load the help text by ID from the database.
To make this easier to implement in the UI, there are a few ways. Perhaps you can create a jQuery client-side behavior.
your HTML would look something like:
<span class="help" id="#{unique-id-here}">Admin</admin>
and you could have jQuery on DOM load:
$(function() {
var help = $(".help");
help.prepend("<img src=\"path/to/images/help.png\" />");
help.click(function() {
//do something with this.id; open a popup, a title bar, whatever.
}
});
We did it on our site by doing the following:
We have a HelpTopics database with a HelpTopicId and HelpTopicText
We create an aspx page that displays the HelpTopicText based on the HelptopicId passed in the querystring.
We set up a css class for the A tag that displays the link to the help with the question mark image.
We created a UserControl named TitleandHelp that contained a link to the page mentioned in step 2 and the style for the link set to step 3 above: The usercontrol has a public rpoperty for the title and one for the topicID (We called it HelpContext).
We add the usercontrol to the aspx page where appropriate
<uc2:titleandhelp ID="titleandhelp1" runat="server" HelpContext="4" PageTitle="Forgot Password" />
it may sound like a lot of work, but really it only takes a half hour or so to do all of the setup. The rest of the work lies in populating the table and dragging the usercontrol onto the pages where appropriate.

Resources