I can not set THM files to asp:image control - asp.net

Why doesn't the image show up when the file extension is THM.
<ItemTemplate>
<asp:image id="ThumbImg" runat="server" imageurl='<%# GeThumb(Container.DataItem) %>' Width ="60px" Height = "60px" />
</ItemTemplate>
The above lines are within asp:gridview in ASPX page.
GetThumb returns url as below.
http://www.xyz.com/images/mythumbnailimage.THM
The image doesn't show on the grid and I don't get to see the typical RED Colored x mark but it is different. In any case the image doesn't show in the grid. The image file exists on the server but will render when I change extension to JPG or TIF.
So my question is what's wrong with THM files. What am I doing wrong here?
Thanks.

Found the image extensions (THM in my case) needs to be added in the server. Added and it started working.

Related

How do I convert asp:textbox to freetextbox

I have an asp:TextBox that I need to convert to a FreeTextBox. The following is my asp:TextBox aspx code:
<%# Register TagPrefix="FTB" Namespace="FreeTextBoxControls" Assembly="FreeTextBox" %>
<asp:TextBox ID="tbxRiskDesc" runat="server" Width="90%" TextMode="MultiLine" Rows="6" onblur="Resize(this);" onkeypress="Resize(this);" ></asp:TextBox>
<rad:RadSpell ID="spellRiskDesc" runat="server" Width="5px" ControlToCheck="tbxRiskDesc" WordIgnoreOptions="UPPERCASE" FragmentIgnoreOptions="EmailAddresses,Urls" DictionaryLanguage="en-AU" SupportedLanguages="en-AU,English" AllowAddCustom="true" DictionaryPath="~/RadControls/Spell/TDF/" SpellCheckProvider="EditDistanceProvider" EditDistance="2" ButtonType="ImageButton" />
The following code is in the aspx.cs code:
Page_Load:
tbxRiskDesc.Attributes.Add("onchange", "setDirty();");
Reset_Data:
SetTextCurrentValue(tbxRiskDesc, dtEditTable, "RiskDesc");
Clear_Data:
SetTextValue(tbxRiskDesc, "RISK TITLE & DESC.:");
When I replace the "asp:TextBox" code in the aspx file with the following, the code behind has errors and i dont know how to change the code for the FreeTextBox for the Page_Load, Reset_Data & Clear_Data sections.
<FTB:FreeTextBox ID="tbxRiskDesc" runat="server"></FTB:FreeTextBox>
The reason for the change over is because we need to allow the users to put bullet points and hyperlinks into the text boxes.
All help is appreciated.
You have two options:
recommended: replace the textbox with RadEditor which has built-in integration with RadSpell
use the RadSpell API to spellcheck the FreeTextBox control: You have to get a reference to the body element of the iframe content area of FreeTextBox. After that you can implement a custom text source similarly as it is done for RadEditor in the following forum thread: Problem with spellcheck.
Using the RadEditor's get_contentAreaElement() method you can get a reference to RadEditor's iframe content area element and after that to get a reference to the body tag of the iframe:
var editorSource = $find('RadEditor1').get_contentAreaElement().contentWindow.document.body;
You should see in the FreeTextBox documentation or forums how to get a reference to the body element and update the above line in the provided in the forum article custom text source code.

Same piece of code works on one page & doesnt work on other Page, asp.net

nesting of image inside a LinkButton shows image on one page & doesn't show image on another page below are two sample code from two different pages in the same root director.It works fine on one page but on the other page is doesn't show any download image rather shows the text download in place of image.
I have done troubleshooting for sometime and replace the code also but it doesnt show download image for any reason on the second page..
<asp:LinkButton ID="lnkbtnDownload" runat="server" onclick="lnkbtnDownload_Click" meta:resourcekey="lnkbtnDownloadResource1">
<asp:Image ID="imgDownload" runat="server" ImageUrl="~/images/download.png" meta:resourcekey="imgDownloadResource1" />
</asp:LinkButton>
<asp:LinkButton ID="lnkbtnDownload" runat="server" onclick="lnkbtnDownload_Click" meta:resourcekey="lnkbtnDownloadResource1">
<asp:Image ID="imgDownload" runat="server" ImageUrl="~/images/download.png" meta:resourcekey="imgDownloadResource1" />
</asp:LinkButton>
HTML OUTPUT
HTML for above two code sample render as below
<img alt="Download" src="images/download.png" id="MainContent_imgDownload">
Download
Both Pages are in the same root directory...
The problem probably comes from a discrepancy in your resource files or missing a resource file completely for the second page. Obviously you have one for the first, but possibly not for the other which has different naming.
If you are using meta:resourcekey, there are some things you have to considerate.
Make sure that your local resource files meet the following criteria:
They are in an App_LocalResources folder.
The base name matches the page name.
For example, if you are working with the page named Default.aspx, the
resource files are named Default.aspx.resx (for the default
resources), Default.aspx.es.resx, Default.aspx.es-mx.resx, and so on.
The resources in the file use the naming convention
resourcekey."property". For example, key name Button1."Text".
Source: MSDN

To access image from C directory and display in a panel

In the below code i am trying to display image inside a panel.But my image cannot access the image from C directory and place inside panel.Pls any one me to solve the issue
docimg.ImageUrl = #"C:\Search\Seardoc\Documents\Desert.jpeg";
imgPnl.BackImageUrl = docimg.ImageUrl;
<asp:Panel ID="imgPnl" runat="server">
<asp:Image ID="docimg" runat="server" Width="100px" Height="100px" /></asp:Panel>
use file:/// before the image name
#"file:\\\C:\Search\Seardoc\Documents\Desert.jpeg";
Example
CSS background image URL failing to load

image in gridview

HI
Im trying to show an image in a gridview, its held on the filesystem and the filename is returned in the datasource query.
If the files are held in C:\TEMP, how would I properly structure the code below?
thanks
<asp:Image ID="Image" runat="server" ImageUrl='<%#"C:\TEMP\" + Eval("ImagePath") %>'
I believe it is along these lines
<asp:Image ID="Image" runat="server" ImageUrl="C:\TEMP\<%= Eval("ImagePath") %>"/>
In this scenario, your ImageUrl value needs to be relative to the root of your web application so if your webapp is in:
c:\iis\MyWebApp
and images are in:
c:\iis\MyWebApp\img the ImageUrl should evaluate to something like ~/img/Img1.jpg
You could store the full path e.g. `~/img/Image1.jpg' in the db or just the filename, in which case you need to add the path to the ImageUrl value either in code-behind or in the markup.
See this article for more information.
Hth.

displaying image in gridview column

I have image in the image folder and in my oracle database I have a column with the name IMG which has the name of
the image like ab.jpg
I have another column with name IMG1 which is storing the whole url like images/ab.jpg
I can see all the values of my database table in my dataset as well including IMG column and IMG1 column
In my aspx file I wrote code
but it is not displaying anything, however aspx page is working fine, it is showing a field but no image and it is blank, same is
the case with IMG1 column as well
Why is it so? What is wrong that I am doing?
I dont want to store image in database, so i store it in the folder
What method should i adopt to make it work?
Update
thats my code
<Columns>
<asp:BoundField DataField= "DD" HtmlEncode="false" HeaderStyle-BorderColor="green"
HeaderStyle-Font-Bold="true" HeaderStyle-Font-Names="Arial"
HeaderStyle-Width="100%" HeaderStyle-Wrap="true" HeaderText="HEAD"
ItemStyle-Width="100%" >
<ItemStyle BorderColor="green" HorizontalAlign="Center" Wrap="true" />
</asp:BoundField>
<asp:TemplateField>
<ItemTemplate>
<asp:Image ID="Image1" ImageUrl="~/images/ab.jpg" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="CC" HeaderText="SHEET" />
</Columns>
If I look at design section it is giving me image sign with a cross but not showing the actual image
location of image is
I have folder A and there I have sub folder images and mywebpage
so both mywebpage and images folder is in folder A
I have used paths as ~/images/ab.jpg and ~A/images/ab.jpg and in both cases it does not work
Method below does not work either
Using Oracle database, which is showing image url columns on dataset and even on grid as mentioned in my last post
What wrong am I doing?
Any solution?
You haven't share your code but you can use ImageField of GridView and set the DataImageUrlField to your image url.
You can alternatively go with TemplateField if you want more control over manipulation of url.
Sharing your code will have if the above doesn't meet your need.
Edit 1:
Since your page and images folder are in same folder try: ImageUrl="images/ab.jpg"
Although ImageUr"~/A/images/ab.jpg" should have worked.
Also to point sometimes the images might not appear in DesignView, so did you try opening your page in browser?

Resources