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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How can i use the image in the asp button control

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :Windows Application

Example i am having a asp button which is used to save the data in the database using the event btnApply_Click.



<asp:Button ID="btnApply" runat="server" Text="Apply"

View Complete Post

More Related Resource Links

Composite Control, File Uploader with 3 image buttons one image button fires but the other two don'


Hi, I've been trying to develop my own custom controls to save me having to write all the bumf of code. I've successfully done all the easy ones but am stuck on this one. I have a file uploader that has a submit image button a view uploaded file button and delete uploaded file button. The control works and will successfully upload the file. however the view button and delete button do not.

here's the code...

[DefaultProperty("Text"), ToolboxData("<{0}:AdminFileUpload runat=\"server\"> </{0}:AdminFileUpload>")]
    public class AdminFileUpload : CompositeControl, INamingContainer
        protected Label lbl;
        protected FileUpload fu;
        protected ImageButton upload; 
        protected ImageButton downloadCurrent;
        protected ImageButton deleteButton;

        [Bindable(true), Category("Miscellaneous"), DefaultValue(""), Localizable(true)]
        public string LabelText
            get { EnsureChildControls(); return lbl.Text; }
            set { EnsureChildControls(); lbl.Text = value; }

        [Bindable(true), Category("Miscellaneous"), DefaultValue(""), Localizable(true)]
        public string FileName
                string s = (string)Vi

Single web control that behaves both as button and Image button control


Hi Everyone,

I am planning to create/use a webcontrol , the behaviour of this control should be in such a way that , it should act as a button or Image button based on the client using that control. I mean if the client wants to use that control as ImageButton it should expose him properties of Imagebutton control like (Image Src, image align etc..), if he wants to use that control as Button it should expose him only button properties and it should not expose any Imagebutton related properties. is it possible to implement such control? i guess i can try generics, but really i am not sure whether i can use generics to solve this problem. or there any other alternatives other than Generics..?

Thank you,


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 ?

Bitmap to Image Control - ImageUrl


 This is my first attempt at using the drawing features of asp.net.  I just want to start simple, and create a single color bar based on a value for a single graph.  I wrote this so far, but I can't figure out how to take the bitmap I just created, and apply it to the Image Control. Do I have to save the file first, and then reload it.

Plus, my box keeps coming out pure black, I trying to fill the box with a color. 

This is part of a web custom control, in which I dynamically created an Image Control. I want to apply the bitmap I made to the image control. 


Dim imgGoogle As Image
imgGoogle = New Image
imgGoogle.ImageAlign = ImageAlign.AbsMiddle
imgGoogle.ImageUrl = cs.GetWebResourceUrl(rsType, "ice5software.BotCatcher.Google.gif")
Private Sub DrawBarGraph_Google(ByVal BarValue As Integer)

	Dim objBitmap As System.Drawing.Bitmap
	Dim objGraphics As S

Gridview with Image Button


i have a gridview and i want to perform edit and delete with an image button

but unable to figure out the events and how i m gonna make my grid into edit mode ??

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                <asp:TemplateField HeaderText="S.No">
                        <asp:Label ID="Label1" runat="server" Text='<%# Container.DataItemIndex+1 %>'></asp:Label>
                <asp:TemplateField HeaderText="Edit">
                        <asp:ImageButton ID="ImageButton1" runat="server" ImageAlign="Middle" 
                            ImageUrl="~/image/ico_edit.gif" CommandName="Edit" 
                            onclick="ImageButton1_Click" />
                <asp:TemplateField HeaderText="Delete">

how to set multiple button in single image


Hi friends,

I need to make multiple button in a single image in asp.net.

and need coding also for vb.net.

thanx in advance

change image button image


i am making a web form with a VB code behind.  on the form I have a down arrow imageButton that when pressed hides certain data.  what i want to do is change the button to an up arrow and vice versa whenever pressed.  i have both images loaded onto my project already.  any suggestions.

thank you

How to retrieve image from DB with Linq and diplay in Image Control


Hi all-


I'm using the file upload to let the user upload a single file.  Here's the code I'm using to then upload to the DB.  How do I reverse this process and dowload the image into the control for it to display on a different page?

Here's my code for the upload - which I think works but can't confirm until I can see the download since all I see in the DB is "binary data"

'update DB with new Image 
        If FileUpload1.HasFile AndAlso FileUpload1.PostedFile.ContentLength > 0 Then
            'Read the file in to a byte Array.
            Dim filebyte As Byte() = FileUpload1.FileBytes
            Dim fileBinary As New System.Data.Linq.Binary(filebyte)
                Dim c3 = (From c In dc.ProductImages _
                          Where c.userID = userGuid _
                          Select c).FirstOrDefault

                c3.productImage = fileBinary

            Catch ex As Exception
                Throw ex
            End Try
Here's my attempt at the retrieval, which isn't working:
                    Dim currentImage = F

Image "Preloader" Control?

Hi,I am trying to pre-load images in my MasterPage. Normally I just use Javascript like so:<SCRIPT language="JavaScript"> var img = new Image(); img.src="/images/pic.png"; </SCRIPT> How "should" I be doing this in an environment that contains a virtual host, one which is determined by the installer of the application. For example, the application can be installed like this:~/someVirtualDirectory/theapp I'm considering creating a Ajax Server Control to accomplish this task, something like the below or maybe even extending the ImageButton and Hyperlink control to do this by default. Is there a much easier way I am missing?<myDomain:imagePreloader ImageUrl="~/images/pic.png" /> Any help, suggestions, etc. would be appreciated!

Binding byte[] to image control in navigation application leaks

Hi there, I have a (minimal) navigation application with two pages. Page1 contains an image. Switching between pages is done via a buttonhandler in code behind, for instance, (this.NavigationService.Navigate(new Page2())) The image is loaded in code behind via: private void LoadImage() { string fileName = "./images/image.bmp"; if (!new FileInfo(fileName).Exists) throw new Exception("File name doesn't exist"); using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read)) { this.ImageData2 = new byte[fs.Length]; fs.Read(this.ImageData2, 0, System.Convert.ToInt32(fs.Length)); fs.Close(); } } ImageData2 is a byte[] property that sends a propertychange event on changing. ImageData2 is bound to an image in xaml: <Image Grid.Row="1" Source="{Binding Path=ImageData2, Mode=OneTime}"/> When we unload Page1 the following clean up code is executed private void Page_Unloaded(object sender, RoutedEventArgs e) { this.ImageData2 = null; GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); } Now, when I start changing pages, I expect the Page we leave to unload, so the GC removes the byte array. However, it doesn't. Am I missing something? Binding the image to a BitmapImage (ImageData1, as you might have guessed:-) ) doesn't leak.

Displaying a System.Drawing.Bitmap in a WPF Image control

How would I convert a System.Drawing.Btimap into a comparable WPF image control so I can display in on my WPF window? Thanks

image slider control

Hiiiii Coders, I m designing my home page. Now here i want a section where five images can be displayed one at a time. For displaying five images there will be five buttons. Whenever user will click on first button it will show first image, if he clicks on second button second image should be displayed, similarly if he clicks on third button third image should be displayed and so on. for making things more clear, please visit the url:  http://www.sterlitetechnologies.com/ see the leftmost bottom section of this page How can i achieve this if this is in javascript plz provide complete code as i m newbie to javascript thanx and regards

Use update progress control to change image control imageurl

UPDATE: Apologies for the previous formatting error - hopefully the post is now more readable... Hi I have a button with an image control next to it. Before the button is clicked, the image control "ConfirmedStatusImage" shows a "cancel.png" image. When the button has been clicked (and some other code successfully executed), then I change the imageurl for the "theConfirmedStatusImage" to show a "ok.png" image. Quite a bit of time can often pass between clicking the button and the associated code executing, so I have an ajax update progress control that shows a "bluespinner.gif" image while the page is updating after the button click. At the moment, the update progress updating image appears next to the "ConfirmedStatusImage" control. However, I would like to change things so that when the update progress starts, the imageurl of "ConfirmedStatusImage" changes from "cancel.png" to the update progress image (i.e., the "bluespinner.gif"). Then, when the update is complete, then the image should change to the "ok.png" image. My question is: how can I achieve this? As far as I can tell, the update progress control does not have any events that I can hook into. Also, placing the "ConfirmedStatusImage" inside the ProgressTemplate would not work either, as this only displays

Control this objectdatasource programatically from the code behind based on different button clicks

I have a page where you can search and display other data, very simple layout. 1 Gridview and 1 objectdatasource. But i have 4 possible buttons that can populate the gridview.. i would like to control my objectdatasource from the code behind based on the button you click. here is what i have right now.. but if possible, can this source not be hardcoded like this and only built in the code behind? <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="SelectDVRInfo" TypeName="DataAccessCode"> <SelectParameters> <asp:ControlParameter ControlID="ddlDVR" Name="dvrInfo" PropertyName="SelectedValue" Type="String" /> </SelectParameters> </asp:ObjectDataSource> I found this site with a solution to this persons issue, but i cant seem to get mine working this way. http://stackoverflow.com/questions/2404264/overwriting-controlparameters-of-datasources-in-code-behind I have  this as the code behind right now when you press the button.. what other parameter settings am i missing and is this the right order to populate them for the source to acknowledge my values?   ObjectDataSource1.SelectMethod = "SelectDVRInfo"; ObjectDataSource1.SelectParameters["MyParameter"]

Open in new window option for Image Button

I am using an Image Button with onclientclick property set.Upon clicking the button I am able to navigate to URL page. But when I am right clicking on the Image Button I am not getting "Open in new window" or "Open in new tab". These options I see when I right click on an Hyperlink control.Can we achieve the same fro Image Button. If so how?Thank you,Praveen.

image as a button

hi alli would like to use an image i created with web button maker as a button in my formwhere do i put the postback action for the button?thank you
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