Author |
Topic |
jhermiz
3564 Posts |
Posted - 2004-10-01 : 07:56:59
|
I cant understand this user control I keep working on.All I'm doing is creating a user control and I want the button to have a calendar gif on it. I tried everything and nothing seems to work to put this image on a button.I do not just want to use an image, I really need this to be a button with an image on it.I have zipped it up can someone take a look? Just add these files to a project and drag and drop the user control. If anyone has any ideas please help me this is urgent :(.Willing to pay 1 whole dollar http://www.jakrauseinc.com/jhermiz/calendar.zip |
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2004-10-01 : 09:36:08
|
Let me give it a shot...<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
 |
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2004-10-01 : 09:43:39
|
Ahhh got it!You made it a regular HTML button. You need to make it an Image button and tie the Javascript call to that button.<asp:ImageButton id="ImageButton1" runat="server" ImageUrl="calendar.gif"></asp:ImageButton>I'm still trying to remember how to make that ASP ImageButton call a client side script. I KNOW it can be done, but I can't remember how.Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
 |
|
jhermiz
3564 Posts |
Posted - 2004-10-01 : 09:45:19
|
Ya but an imagebutton doesnt have a button on it its just an image...I cant use it...I need to have a button background on it. |
 |
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2004-10-01 : 09:50:38
|
Ahh, I found it.http://www.dotnet247.com/247reference/msgs/27/135706.aspx Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ImageButton1.Attributes.Add("onclick", "OnClick();return false;") End SubMichael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
 |
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2004-10-01 : 09:52:47
|
Ohhh you want a button, with an image in the middle of it.Methinks you should use an Image button, and make the image look the way you want it to look (IE, draw teh button around the calendar image). I don't think I've ever seen a "button" with an image on it.Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
 |
|
jhermiz
3564 Posts |
Posted - 2004-10-01 : 09:53:10
|
hmm????So that will add the image? I don't see how that will help me since that is just the codebehind. |
 |
|
jhermiz
3564 Posts |
Posted - 2004-10-01 : 09:54:20
|
quote: Originally posted by MichaelP Ohhh you want a button, with an image in the middle of it.Methinks you should use an Image button, and make the image look the way you want it to look (IE, draw teh button around the calendar image). I don't think I've ever seen a "button" with an image on it.Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
:( that is bad news :(...no XP effect...:( |
 |
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2004-10-01 : 09:56:45
|
This might help. They change the background image of the button on rollover, but I think you can rip out the guts of this code and make it work for you.http://www.dynamicdrive.com/dynamicindex5/button2.htmhttp://www.dynamicdrive.com/dynamicindex5/button2_dev.htmMichael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
 |
|
jhermiz
3564 Posts |
Posted - 2004-10-01 : 10:07:30
|
Ok i created an image button..I added the following code behind: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here ImageButton1.Attributes.Add("onclick", "OnClick();return false;") End SubBut the calendar doesnt pop up anymore it refreshes the page for some reason...The HTML is as follows:<%@ Control Language="vb" AutoEventWireup="false" Codebehind="CalendarControl.ascx.vb" Inherits="ims.jakah.com.CalendarControl" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %><asp:textbox id="txtIssueClosed" Width="96px" runat="server"></asp:textbox><asp:ImageButton id="ImageButton1" runat="server" ImageUrl="/images/calendar.gif"></asp:ImageButton><br><div id="divCalendar" style="DISPLAY: none; POSITION: absolute"><asp:calendar id="Calendar1" Width="200px" runat="server" CellPadding="4" BorderStyle="Outset" BorderColor="#C7D6E4" Font-Names="Arial" Font-Size="8pt" Height="180px" ForeColor="Black" BackColor="White" BorderWidth="2px"> <TodayDayStyle ForeColor="Black" BackColor="#CCCCCC"></TodayDayStyle> <SelectorStyle BackColor="#CCCCCC"></SelectorStyle> <NextPrevStyle VerticalAlign="Bottom"></NextPrevStyle> <DayHeaderStyle Font-Size="7pt" Font-Bold="True" BackColor="#CCCCCC"></DayHeaderStyle> <SelectedDayStyle Font-Bold="True" ForeColor="White" BackColor="#666666"></SelectedDayStyle> <TitleStyle Font-Bold="True" BorderColor="Black" BackColor="#999999"></TitleStyle> <WeekendDayStyle BackColor="#FFFFCC"></WeekendDayStyle> <OtherMonthDayStyle ForeColor="Gray"></OtherMonthDayStyle> </asp:calendar></div><script>function OnClick(){ if( divCalendar.style.display == "none") divCalendar.style.display = ""; else divCalendar.style.display = "none";}</script> |
 |
|
jhermiz
3564 Posts |
Posted - 2004-10-01 : 10:10:58
|
Err this image button goes back and makes a trip back to the server...i cant use that...My original question should still have a way to place an image on it...I see there is a BACKGROUN IMAGE attribute of this input style:<INPUT style="BACKGROUND-POSITION-X: center; BACKGROUND-IMAGE: url(/images/calendar.gif); WIDTH: 24px; BACKGROUND-REPEAT: no-repeat; FONT-FAMILY: Arial, SansSerif, Verdana; HEIGHT: 24px" onclick="OnClick()" value="..." type="button">In the design view i see this image on this button...but immediately when I run this project its gone...I even tried getting rid of the value="..." attribute. Why does the design view show me this image but doesnt show me when the project runs.Thanks Jon |
 |
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2004-10-01 : 10:29:13
|
The return false made the page not post back for me. You might need to put that in your actual javascript function, but the way you have it there worked for me.As far as why your other way didn't work, did you try putting the full path to the image in for the Background? I suspect that it might be a pathing issue. If you put the full path in there and it works, then you need to work out the slashes and dots in the URL to make it work correctly.Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
 |
|
jhermiz
3564 Posts |
Posted - 2004-10-01 : 10:31:59
|
Dunno I tried ../images/calendar.gif/images/calendar.gifI even had it set it for me using browse ...In design view I see it...but when I run the project on the web server the image doesnt show...i guess its not a big deal I can deal with ... as text in the image, but it was just a gui aspect. |
 |
|
chadmat
The Chadinator
1974 Posts |
Posted - 2004-10-01 : 14:22:44
|
Is the Image in the same relative location on the web server as it is on your development machine?-Chadhttp://www.clrsoft.comSoftware built for the Common Language Runtime. |
 |
|
jhermiz
3564 Posts |
Posted - 2004-10-01 : 14:27:23
|
i was working on this directly from the server..so yes i should be able to see it via /images/calendar.gif.Surely something else is wrong. |
 |
|
mroku
Starting Member
3 Posts |
Posted - 2004-10-20 : 07:42:22
|
jhermiz, what's your operating system ?I recently came into a weird problem with button backgrounds on XP.Generally the style something like yourBACKGROUND-IMAGE: url(/images/calendar.gif) on the buttonshould work fine. It works without any problems on W2K.However on XP it works on some pages while on the others the background image doesn't show up.So far I don't know the solution for that. |
 |
|
mroku
Starting Member
3 Posts |
Posted - 2004-10-20 : 08:37:23
|
That's what I found.[url]http://support.microsoft.com/default.aspx?scid=kb;en-us;322240[/url] |
 |
|
mroku
Starting Member
3 Posts |
|
|