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

Top 5 Contributors of the Month
Post New Web Links

How To set DefaultValue of ImageUrl of CompositeControl ImageButton

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


how to set DeafultValue of ImageUrl to embeded resource so when Client imput's ImageUrl="~/someimege.png" his image would show but if the client doesn't imput Url Default image would show. That Url must not be visible in properties window...

<DefaultProperty("Time"), ToolboxData("<{0}:TimePickerGTI runat=server />")>
    Public Class TimePickerGTI
        Inherits CompositeControl

        Private TimeButton As ImageButton
        <Bindable(False), Category("Default"), DefaultValue("Default"), Description("UpDown Image Url.")> _
        Public Property UpDownImageUrl() As String
                Return TimeButton.ImageUrl
            End Get
            Set(ByVal value As String)
                TimeButton.ImageUrl = value
            End Set
        End Property
        Protected Overrides Sub CreateChildControls()
            TimeButton = New ImageButton
            TimeButton.ID = "TimeButton"
            TimeButton.Height = 18
            TimeButton.ImageAlign = ImageAlign.Middle
        End Sub
        Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)

View Complete Post

More Related Resource Links

I need help with imagebutton links


I have imagebuttons as links and i added the attributes for mousedown, up and out. That works fine.  I cant seem to figure out how that the imagebutton itself, when pushed, stays down and returns to normal when the user clicks another link....

what I was thinking of doing is calling a method on the onclick event of the button and letting it check whether there is another button pushed down then to send the found link button to its orginal state.

I figured doing the call and checking of the buttons would be long winded with the method, so there must be an easier way to do this ?




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

ImageURL SiteMap Node


Hi Can anyone tell me how i can add the ImageURL from a sitemap into a navigation menu, i had this working with webforms but cannot get it to work with mcv

var sbMenuHelper = new StringBuilder();

sbMenuHelper.Append("<ul class='cssMenu'>");

var topLevelNodes = SiteMap.RootNode.ChildNodes;
foreach (SiteMapNode node in topLevelNodes)
    if (SiteMap.CurrentNode == node)
        sbMenuHelper.AppendFormat("<a href='{0}'>{1}</a>", node.Url, helper.Encode(node.Title));

return sbMenuHelper.ToString();

        description="Contact Us"

Suppress postback on ImageButton


I have the following JavaScript defined for the OnClientClick event of an ImageButton:

var _oHasChanged = $get(_chkHasChanged); if (_oHasChanged && _oHasChanged.checked) { alert('De gewijzigde gegevens moeten worden opgeslagen alvorens deze actie kan worden uitgevoerd.'); return false; }

As you can see, I have "return false;" after the alert, because I don't want a postback in that situation.

This is working just fine in Firefox, but Internet Explorer seems to ignore the "return false;" bit and posts back to the server anyway.

What am I missing here?

Image or ImageButton rounded corners


Hiiiii Coders,

I just want to make corners of my asp.net image or imagebutton rounded. How can i do so?  

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

imagebutton, sub signature, by ref

Hi Below is my codeThe first 3 lines are run in the DataList1_ItemDataBound event and they call the sub below, of which there is the opening line.My question is if I change the signature from System.Web.UI.WebControls.Image toSystem.Web.UI.WebControls.ImageButton this still works and vice versa so it'll work in the found control is either a imagebutton or image.1. Can anyone explain why it does work fine either way?2. The ByVal ImgProfile As System.Web.UI.WebControls.Image, should this be ByRef, aren't controls passed by reference rather than value?Or I am getting this mixed up. The reason why I say this is I can modify the image control that's passed in and if it was passed by value then I shouldn't be able to modify the control, or should I?Dim Image1 As ImageImage1 = CType(e.Item.FindControl("ImageButton1"), Image)DisplayImage(UserID, Image1)Protected Sub DisplayImage(ByVal pUserID As String, ByVal pImgProfile As System.Web.UI.WebControls.Image)thanks.

ImageURL unable to show picture

Hi all, I'm trying to display the picture that i have saved using the fileUploadControl functions. so far my code can save the picture to the folder that I want but the picture does not appear on my webpage. I used the code at visual studio 2005 and it works totally find but when I put it at visual studio 2008 it doesn't work fully. can somebody teach me how to solve this problem?? is there a new updates at visual studio 2008 that i missed??below are my codes. Protected Sub btnUpload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpload.Click 'Folder directory Dim picFolder As String = "C:\Users\Kartika\Documents\Visual Studio 2008\Projects\ProrsumTestK\ProrsumTestK\pictures\" 'Dim audioFolder As String = "C:\Users\AdminNUS\Documents\Visual Studio 2005\Projects\BLABProgram2\audio\" 'Get the name of the file which is to be uploaded this also returns the whole path of the file Dim picFileName As String = picURL.PostedFile.FileName 'Dim audioFileName As String = audioURL.PostedFile.FileName 'Extract the file name from the whole file path Dim picFileURL As String = System.IO.Path.GetFileName(picFileName) 'Dim audioFileURL As String = System.IO.Path.GetFileName(audioFileName) Try 'Create the directory

Save an ImageButton to the viewstate?

Hi!I have created a custom control that extends the class ImageButton, the thing is that I now also want to save this control to a viewstate...is there anyway to do this?Thanks in advance!

ImageButton does not fire

Hi.I have the following image button:<asp:ImageButton ID="submit" EnableViewState="true"                                   ImageUrl="/images/btn_submit.png" AlternateText="Submit" CssClass="f-right"                                 runat="server" onclick="submit_Click"></asp:ImageButton>The event is fired in Firefox but not in IE*. anyone any ideas?ThanksJason.

DataGrid cells ImageUrl properties problem

At the outset i would like to welcome all as this is my first post on this forum :) probably i've got a simple problem for most of you, namly:   I want to dynamically replace ImageUrl into DadaGrid cell. I've already prepare a right type of field (Image Field) and this is my code:   Private Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.Cells(3).Text = "1" Then e.Row.Cells(3).Text = "Online" DirectCast(e.Row.Cells(4).Controls(0), Image).ImageUrl = "~/Css/green.png" 'e.Row.Cells(9).ForeColor = System.Drawing.ColorTranslator.FromHtml("#489A38") 'e.Row.ForeColor = System.Drawing.Color.LightGray Else e.Row.Cells(3).Text = "Offline" DirectCast(e.Row.Cells(4).Controls(1), Image).ImageUrl = "~/Css/red.png" End If End If End Sub And i.ve got this error: Specified argument was out of the range of valid values.Parameter name: index Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and whe

Click imagebutton open window.open in class asp.net 2.0

Click imagebutton open window.open in class asp.net 2.0

Disable "enter" click on imagebutton

When i press "enter" i dont want the first button that is on my page getting fired. This is a imagebutton. I did try with a javascript function that checks the event keycode but this always returns 13.<script language="javascript"> function noEnter() {  if (event.keyCode == 13) {  return false;    }  }  </script> When i add OnClientClick="return false;" then you can't press the button at all.<asp:ImageButton ID="backButton" runat="server" CausesValidation="false" ImageAlign="AbsBottom" ImageUrl="../../images/Global/back.gif" OnClientClick="GoBack2_Click" OnClick="GoBack_Click" OnClientClick="return false;"/> When i click with the mouse on the button the Goback function does not get called. So what i'm trying to get here that the imagebutton need to be clicked with a mouseclick and not with and enter keystroke. ty ;)      

Problem with Imagebutton/general questions

Hello,I am new to .NET development, to HTML and javascript, actually to the whole "web" scenario, however I am a game programmer (AS, Java, C#...) but I am having some trouble with some aspects of web programming (actually one, the "statelessness" of it =P) and the syntax is also new to me so there are some things that I have an idea of how to make, but cant actually make it without hours of research on the web.My first question here is one that I guess should be very simple. I am developing a picture album, and there are 2 images that serve as buttons to go to the next page. However, some albuns will not have more pictures then one page. What Im doing is detecting wheter or not my List.count is higher or lower then the required number to have multiple pages. If it is, the ImageButton of the "nextpage" btn will be "image1" and in case its not, "image2". However, on the page code I tryed using the same method I am using for pictures.Regular Picture:<img src='<%= VerificarThumb(8)%>' alt="Teste"/>ImageButton:<asp:ImageButton ID="prxpg" runat="server" ImageUrl="<%= VerQtd(false)%>" Height="93px" onclick="PrxPg" Width="31px" PostBackUrl="~/Default.aspx" />This does not work. Is there some other way to call a C# method for

ImageButton onClick

 I created an image button called "pic1" with the OnClick feature. When clicked it runs "btnClicked".   In the sub "btnClick", how would I get information? One example is to get the button tooltip.  I tried this: request.form.item("pic1.tooltip"). That did not work.

Imagebutton inside Listview inside another Listview

Hi,I'm trying to change the visibility of a imagebutton to false, if the imagebutton.ImageUrl="".The problem is that the imagebutton is inside "ListView2", and "ListView2" is inside "ListView1".Who can I do this in vb code... or even a javascript.Thanks

NOT getting the defaultValue for a ConfigurationProperty


I have a very simple Configuration Section.....

public myConfigSection : ConfigurationSection


   [ConfigurationProperty("MyValue", DefaultValue = null)]

   public string MyValue


      get { return (string)base["MyValue"]; }

      set { base["MyValue"] = value; }




My problem is that I never get null returned (as stated in the default value) I get an empty string instead.

An empty string is a valid configuration item that the business can specify for this in the configuration file. I now need to know if the the configuration file has an empty string or if it does not contain this item in the configuration file.


I have seen a few posts for this but nothings appears to provide a solution.




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