Showing posts with label imageurl. Show all posts
Showing posts with label imageurl. Show all posts

Thursday, March 22, 2012

strange hyperlink focus problem

i have inserted a hyperlink into a form:

<asp:hyperlink id="OpenCalendarLink" runat="server" imageurl="../../images/button_calendar.gif">
</asp:hyperlink>

there is an <asp:textbox> before my hyperlink but when I tab out of my textbox the cursor focus jumps past my hyperlink. I have tried tabbing all across the page and the cursor never focuses on my hyperlink. Yet on a different page I have a hyperlink within the <edititemtemplate> of a dataSet and the cursor focuses on the hyperlink within that page.

can anyone help me solve this problem please!Post the code to the ASPX page and I'll take a look.
here is my code thanks darrell:


<%@. Page language="c#" Debug="true" Codebehind="trnew.aspx.cs" AutoEventWireup="false" Inherits="PinpointOnline.TimeRecordingNewPage" %>
<%@. Register TagPrefix="date" Namespace="PeterBlum.PetersDatePackage" Assembly="PetersDatePackage" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
<html>
<head>
<title>PINPOINT ONLINE</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="http://links.10026.com/?link=../../css/timerecording.css" type="text/css">
<script language="JavaScript">
function SelectMatter(){
var lookupWin = window.open('../misc/mattersearch.aspx?parent=trnew&by=Code&page=1&totpages=0&for='
+ window.document.forms['TRNewForm'].elements['NewDisplayCodeTB'].value,
'mattersearchWin', 'scrollbars=yes,resizable=yes,width=660,height=500', true);
}
function SelectAttCode(){
var lookupWin = window.open('../misc/attcodesearch.aspx?fecode=0&rscode=2&dcode=SPE0287&by=Code&page=1&totpages=0&for='
+ window.document.forms['TRNewForm'].elements['NewAttCodeTB'].value,
'attcodesearchWin', 'scrollbars=yes,resizable=yes,width=660,height=500', true);
}
function submitit()
{
document.forms[0].action="trview.aspx";
document.forms[0].target="viewFrame";
document.forms[0].__VIEWSTATE.name = 'NOVIEWSTATE';
document.forms[0].submit();
self.TRNewForm.NewDateTB.focus();
}
</script>
</head
<body class=bodystyle2 text=#000000
onload=javascript:self.TRNewForm.NewDateTB.focus();>
<form id=TRNewForm runat="server">
<div id=Layer1
style="Z-INDEX: 1; LEFT: 0px; WIDTH: 100%; POSITION: absolute; TOP: 10px">
<table class=tablenew1 cellspacing=0 cellpadding=0 width="100%" border=0>
<tbody>
<tr>
<td nowrap=true>
Date:
<date:datetextbox class=formcontent3 id=NewDateTB
runat="server" xinitiallyblankrule="Today"
xinvaliddatemsg=" " xerrorbackcolor="Red"
columns="11" xshowpopupb="False"
xenablecontextmenub="False">
</date:datetextbox>
<asp:hyperlink id=LoadCalendarPopupLink
onclick="javascript:calendar_window=window.open('../misc/calendar.aspx?form=TRNewForm&textbox=NewDateTB','DatePicker','width=220,height=179,left=134,top=80'); calendar_window.focus();"
runat="server"
imageurl="../../images/button_calendar.gif">
</asp:hyperlink>
</td>
<td align=right width="100%">
<date:datetextboxvalidator id=NewDateTBValidator runat="server"
controltovalidate="NewDateTB"
font-bold="True">
</date:datetextboxvalidator>
<input class=formcontent1 readonly=true size=12
name=NewTimeDisplayTB><input class=formcontent1 onclick=stopWatch1.startclock() tabindex=-1
type=button value=start name=NewStartClockButton><input class=formcontent1 onclick=stopWatch1.stopclock() tabindex=-1
type=button value=stop name=NewStopClockButton><input class=formcontent1 onclick=stopWatch1.resetclock() tabindex=-1
type=button value=reset name=NewResetClockButton>
</td>
</tr>
</tbody>
</table>
<table class=tablenew2 cellspacing=0 cellpadding=0 width="100%" border=0>
<tbody>
<tr>
<td nowrap=true>
Matter:
<asp:textbox class=formcontent4 id=NewDisplayCodeTB tabindex=-1
runat="server" readonly="true" size="12"
maxlength="12">
</asp:textbox>
<input class=formcontent1 onclick=SelectMatter(); type=button
value=... name=LoadMatterSearchPopUpButton>
</td>
<td nowrap=true>
Client:<input class=formcontent1 tabindex=-1 readonly=true maxlength=50 size=50
name=NewDisplayNameTB>
</td>
<td valign=baseline nowrap=true width="100%">
LA:<img height=13 src="http://pics.10026.com/?src=../../images/checkbox_blank.gif" width=13 align=absMiddle
name=NewLAImage>
</td>
</tr>
</tbody>
</table>
<table class=tablenew3 cellspacing=0 cellpadding=0 width="100%" border=0>
<tbody>
<tr>
<td nowrap=true>
Narrative:
<asp:textbox class=formcontent1 id=NewNarrativeTB
runat="server" size="50" maxlength="50">
</asp:textbox>
</td>
<td nowrap=true>
Rate:
<asp:dropdownlist id=NewRateSchemeDDL runat="server"
enabled="false" cssclass="formcontent1">
</asp:dropdownlist>
</td>
<td nowrap=true>
AT:
<asp:textbox class=formcontent1 id=NewAttCodeTB runat="server"
size="7" maxlength="7">
</asp:textbox>
<input class=formcontent1 onclick=SelectAttCode(); type=button
value=... name=LoadAttCodeSearchPopupButton>
</td>
<td nowrap=true>
Time/Units:
<asp:textbox class=formcontent1 id=NewUnitsTB runat="server"
size="6" maxlength="6">
</asp:textbox>
</td>
<td nowrap=true width="100%">
<asp:button id=SubmitFormButton runat="server"
cssclass="formcontent2" value="submit" text="Submit">
</asp:button>
</td>
</tr>
</tbody>
</table>
<table class=tablenew4 cellspacing=0 cellpadding=0 width="100%" border=0>
<tbody>
<tr>
<td>
</td>
</tr>
</tbody>
</table>
</div>
</form>
</form>
</tr>
</tbody>
</table>
<div>
</div>
</form>
</body>
</html>

Strange issue with ImageButton with no ImageUrl

I realize that there is no good reason for an image button to not have an
ImageUrl but I have just hit upon a strange problem when converting an
ASP.NET 1.1 web application to 2.0. An asp:ImageButton control without an
ImageUrl contained within a WebForm causes a redirect to the default
document in IIS. This behaviour did not occur in .NET 1.1.
This can easily be duplicated by the following steps :-
1. Create a new ASP.NET Web Application project in VS2005.
2. Add a new Web Form (WebForm1.aspx)
3. In the existing Default.aspx add a standard asp:Button to the form and
add a standard on click event handler containing a simple
Response.Redirect("WebForm1.aspx");
4. Add an asp:ImageButton to WebForm1.aspx, e.g <asp:ImageButton
ID="ImageButton1" runat="server" />
5. Set two breakpoints, one on each Page_Load method of both Web Forms.
Debug the application, you will notice it breakpoints on the Default.aspx
page load and on the postback when you press the button. This is fine. It
will then breakpoint on the page load of WebForm1.aspx and *THEN* redirect
back to Default.aspx and break on the page load event again. The final
breakpoint does not occur if the ImageUrl is completed or if no default
document has been setup in IIS.
Thanks
Garythis is standard browser behavior. any img, script, css, etc, with a src="http://pics.10026.com/?src="
or missing, will use the default path as the url. iis will usually redirect
to default.aspx (or whatever is the default).
-- bruce (sqlwork.com)
"Gary K" wrote:

> I realize that there is no good reason for an image button to not have an
> ImageUrl but I have just hit upon a strange problem when converting an
> ASP.NET 1.1 web application to 2.0. An asp:ImageButton control without an
> ImageUrl contained within a WebForm causes a redirect to the default
> document in IIS. This behaviour did not occur in .NET 1.1.
> This can easily be duplicated by the following steps :-
> 1. Create a new ASP.NET Web Application project in VS2005.
> 2. Add a new Web Form (WebForm1.aspx)
> 3. In the existing Default.aspx add a standard asp:Button to the form and
> add a standard on click event handler containing a simple
> Response.Redirect("WebForm1.aspx");
> 4. Add an asp:ImageButton to WebForm1.aspx, e.g <asp:ImageButton
> ID="ImageButton1" runat="server" />
> 5. Set two breakpoints, one on each Page_Load method of both Web Forms.
> Debug the application, you will notice it breakpoints on the Default.aspx
> page load and on the postback when you press the button. This is fine. It
> will then breakpoint on the page load of WebForm1.aspx and *THEN* redirect
> back to Default.aspx and break on the page load event again. The final
> breakpoint does not occur if the ImageUrl is completed or if no default
> document has been setup in IIS.
> Thanks
> Gary
>
>
> this is standard browser behavior. any img, script, css, etc, with a
> src="http://pics.10026.com/?src="
> or missing, will use the default path as the url. iis will usually
> redirect
> to default.aspx (or whatever is the default).
Thanks for the reply Bruce, that does make sense now.
The generated html is different between the versions of Visual Studio, I now
see the src="http://pics.10026.com/?src=" has been added :-
VS2003
<input type="image" name="ImageButton1" id="ImageButton1" alt="" border="0"
/>
VS2005
<input type="image" name="ImageButton1" id="ImageButton1" src="http://pics.10026.com/?src="
style="border-width:0px;" />
That explains it.
Thanks
Gary