.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Imran Ghani
Sohaib Khalid
Post New Web Links

Image tag rendering inside repeator

Posted By:      Posted Date: October 07, 2010    Points: 0   Category :ASP.Net

i have a repeator control that is bind to a dataset, one of the field is image path that is bind with <img src tag. Now the problem is so of the articles are with out any image, how can i make sure that <img tag only render when there is an image name exist?

   <asp:Repeater runat="server" ID="rptCollections">
                <br />
                        <img style="margin-right: 10PX; width: 200PX; float: left;" src="<%#Eval("MainImage ").ToString()%>" /><%#Eval("Summary").ToString()%></p>--%>
        <asp:Repeater runat="server" ID="rptContent">
                <table border="0" cellpadding="0">

View Complete Post

More Related Resource Links

image inside custom server control



I want to use an image inside a Custom Web server control ! 

Do I need to use Web.resources ? if so , how to do ?

Image stretch inside a grid stops working horizontally once columns are added to grid.

I have a simple setup of a window. Window contains a grid, inside the grid there is an image. I want the image to always stretch across the entire cell. I've set it's Stretch property to Fill and it works fine, as long there is only one column in the parent grid. As the window is resized, the image stretches correctly. As soon as I add another column, the image stops stretching horizontally. Vertially it works just like before, horizontally it now appears with a fixed width corresponding to the width of the picture used as the source. Does not matter which column it's positioned in, and I've tried encapsulating it into another grid but behaviour does not change. It behaves the same in both Visual studio 2010 designer and at runtime. In addition when I tried to encapsulate it in a second grid, this seond grid also now has altered behavior - instead of sizing itself to it's container (both height and width are not set) as it's parent grid does, it now sizes itself to its contents - the image. But only horizontally. What is going wrong here, is this a bug or am I missing something, and any advice on how I can get the image to fill one of the cells of a grid with more then one column?

Alert not working when used with image inside gridview

I am currently using following code to set alert on required column of my grid. When I change button type to Image the alert appear after completion action. Any quick suggestion??   My code is below.. protected void grdDelTempList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[6].Attributes.Add("onClick", "javascript:return confirm('Are You Sure?');"); } }    
shows extra lines around the image   

I am working with two different 'rounded corner' images and I am getting an extra line at the top of the smaller image.  The first image, headerborder_corner_tl_3.png, is 25 x 25.  This image diplays correctly in the first <div> below. 

The second image, pageborder_corner_tl_4.png, is 15 x 15.  In the second <div> below, the image gets displayed with an extra line at the top of the image.  But if I comment out the second <td>  (as I do in the third <div>) the image displays correctly.

Looking at the second div, can someone shed some light on what might be causing the image to be displayed with an extra line above it...or why it displays correctly when I comment out the second <td>?

        <table bgcolor="#F6AD2C" cellpadding="0" cellspacing="0" align="center">
                <td width="25" height="25">
                    <img src="<%= Page.ResolveUrl("~&q

Problem with Editing image inside DetailsView inside UpdatePanel



I have a problem and I really hope you'll be able to help me.

I'm trying to add and edit an image which is located in a detailsview which is inside an UpdatePanel. After I read relevant topics in the forum I installed the Ajax Control Toolkit. Below is my source code. When I used it only for insert new image it worked great. The problem caused when I tried to implement it on the Edit mode, i.e. when I tried to edit the image and upload a different image.  Unfortunately it didn't work as I hoped. Nothing happend and the image hasn't been changed. I also tried to change the IDs (AsyncFileUpload ID) to be the same in both places but it didn't work either.

The source code:

<asp:DetailsView ID="dvMovie" runat="server" Height="50px" Width="695px"
                    AutoGenerateRows="False" DataSourceID="sdsMovieById"      
                     BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px"

ASP Image inside UpdatePanel changing ImageUrl



I have a WebForm which has an update panel. Inside the panel I have an ASP Image. I have also, 2 ImageButtons which act as the triggers for the UpdatePanel.

<asp:UpdatePanel ID="updImage" runat="server">
          <asp:AsyncPostBackTrigger ControlID="btnBackward" EventName="Click" />
          <asp:AsyncPostBackTrigger ControlID="btnForward" EventName="Click" />
          <asp:Image ID="Image1" runat="server" Width="75px" Height="75px" BorderStyle="Solid" BorderWidth="5px" BorderColor="White" />

In my WebForm, I also have an ASP Image component outside the Update panel.

The ImageUrl of those ASP Image components are loaded from a folder that is outside the WebSite root folder, using the code found in this link:


Can SharePoint field control have update panel inside a rendering template?


I am creating a custom field control with the following rendering template



SharePoint:RenderingTemplate Id="TestFieldRendering" runat="server">


Rendering Issues when embedding Notepad inside a WPF Window


My end goal is not to embed Notepad inside of a WPF window. I am using Notepad to demonstrate this issue because I am having the same problems with Notepad that I do when I attempt to embed a Labview Virtual Instrument into a WPF window.

The primary problem I am having is that there are rendering problems with the embedded Notepad window whenever I move or maximize the window. I am looking for advice on how I can make it so that the embedded window will not have these rendering issues.

My second problem is that I would like the embedded window to take up the full size of the form whenever the form is resized. If this is not possible, I'll just prevent resizing of the WPF window.

You can download my VS2010 C# 4.0 WPF solution from here: http://rapidshare.com/files/426808705/Win32Fun.zip

handle image inside div tag


is there any way to fit the image size @ div size.

i mean my image is little bigger or little lower in size than div size or assume i have a div which has not hight and width attribute then how do i handle image inside div. i think it is not possible to handle when div has no h&w attributes and in this case image will come with its own h&w.

but if have defined the h&w for any div tag then there should be some way to manage little size differences.

or reply me if you have a good way to manage size consistency.


PublishingWebControls:RichImageField show html code for the image instead of rendering the image


I am modifying the article page layout to display more than one image. The rendered page does not show the image. Its showing the <img> tag instead.

Please help!

Rendering controls via Loop inside Render


I am creatin a server control where
some controls are being rendered inside  `protected override void Render(HtmlTextWriter writer)`

    writer.AddAttribute(HtmlTextWriterAttribute.Type, "button");
    writer.AddAttribute(HtmlTextWriterAttribute.Id, this.UniqueID + "butto_Foo1");
    writer.AddAttribute(HtmlTextWriterAttribute.Value, "Button1");
    writer.RenderEndTag(); //button
    writer.AddAttribute(HtmlTextWriterAttribute.Type, "button");
    writer.AddAttribute(HtmlTextWriterAttribute.Id, this.UniqueID + "butto_Foo2");
    writer.AddAttribute(HtmlTextWriterAttribute.Value, "Button2");
    writer.RenderEndTag(); //button       

This way buttons are rendered on design view as well. 
The problem is that number of buttons to render is dynamic based on data in xml file (even if the data was static, the number of button is about 12 and I don't think it is wise to copy paste the same code above 6 times...).

I thought by using loop

Radio buttons, a label and an image button show twice inside update panel


I have an update panel with a set of 2 radio buttons, a label and an image button inside of it. There another set of 3 radio buttons that trigger the update panel. I got everything working but now the image button, label and set of 2 radio buttons inside the update panel show up twice when the radio button triggers are selected? Any ideas?

Image Inside a webpart


Hi All Gurus

I am trying to create a webpart in which I have 15-20 images & I want the images to change as per the month & season. the images are static they will never change.

Can someone pls suggest me the best way to achive this. I am looking for a solution from scratch.

My Approach (I am thinking but open to your inputs) is;

1) Create a User ctrl & place a Image control on it.
Here what will be my URL to make the webpart look at ~layout/image/New Foldername/Image.Imageextn (If some one can give me a code snippet of this will be a great help. I will surely vote :)

But with the above appraoch I am thinking where to store my images physically other than Layouts, also this will be deployed to multi WFEs

Also, if I want to use the layouts folder, what will be my DDF file command to create the folder in ~layout/image/New Foldername/Image.Imageextn

Thanks in advance Vote assured
Happy Sharepointing.

I am a learner So your help will help me build


Happy Sharepointing... Regards SPTECH07

Accessing the different controls inside a GridView control

how we can access a particular control which resides inside a GridView control. In this article I will show you how you can access different controls inside a GridView control. We will see how we can access a TextBox control, a DropDownList control and a ListBox control. If you are working with ASP.NET 1.X then you might want to check out my article Accessing Different Controls Inside a DataGrid.

How To Add calendar control inside a GridView

This article show hot to add calendar control inside a GridView with code in c#

Using ATLAS PopUp Control with Calendar inside the GridView Control

In this video tutorial Mohammad demonstrates how you can access the Calendar control which is displayed using the ATLAS PopUp control inside the GridView control.

RadioButton inside GridView, How to get it work as normal

Did you tried before to drag a RadioButton control inside a Gridivew templatefield, and then you attempt to select these RadioButtons , you will notice that the behavior of RadioButton control will be changed and it will work just like the behavior of checkbox control! the user will be able to select more than one radiobutton in the grid!
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend