<a href> around an <asp:imagebutton> not working - need some help | | |
I have an HTML table with several fields like this:
<A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood"
ImageUrl="images\buttons\btn-food-i.gif" runat="server"></asp:imagebutton></A>
When the user sees these buttons, they will currently be on the
savings.aspx?category=whatever page, and when they click another button to
look at other categories, all the links I have around these buttons direct to
their various categories.
However, when I press these buttons, nothing happens.
Did I forget to do something here?
thanks for the help | | | | re: <a href> around an <asp:imagebutton> not working - need some help
I also tried removing the <a href> tags around the ImageButtons and creating
Click events for the buttons with
Response.Redirect("savings.aspx?category=whatever" );
and placed a breakpoint on these statements in my Click code and they don't
event get executed.
I must be missiong something really small here :P
Thanks again
"tperri" wrote:
[color=blue]
> I have an HTML table with several fields like this:
>
> <A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood"
> ImageUrl="images\buttons\btn-food-i.gif" runat="server"></asp:imagebutton></A>
>
> When the user sees these buttons, they will currently be on the
> savings.aspx?category=whatever page, and when they click another button to
> look at other categories, all the links I have around these buttons direct to
> their various categories.
>
> However, when I press these buttons, nothing happens.
>
> Did I forget to do something here?
>
> thanks for the help
>
>
>[/color] | | | | re: <a href> around an <asp:imagebutton> not working - need some help
That is probable because the ImageButton is rendered as an <input> element
in the HTML.
Why do you want to wrap an ImageButton in an anchor? Suppose what you
wanted to do works, when the postback happens, how is the hyperlink suppose
to react since the past has already navigated. After all, the browser
cannot navigate to two pages at the same time.
"tperri" <tperri@discussions.microsoft.com> wrote in message
news:93083307-EB6D-4E35-AEF8-B1F725A58003@microsoft.com...[color=blue]
> I also tried removing the <a href> tags around the ImageButtons and[/color]
creating[color=blue]
> Click events for the buttons with
> Response.Redirect("savings.aspx?category=whatever" );
> and placed a breakpoint on these statements in my Click code and they[/color]
don't[color=blue]
> event get executed.
>
> I must be missiong something really small here :P
>
> Thanks again
>
> "tperri" wrote:
>[color=green]
> > I have an HTML table with several fields like this:
> >
> > <A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood"
> > ImageUrl="images\buttons\btn-food-i.gif"[/color][/color]
runat="server"></asp:imagebutton></A>[color=blue][color=green]
> >
> > When the user sees these buttons, they will currently be on the
> > savings.aspx?category=whatever page, and when they click another button[/color][/color]
to[color=blue][color=green]
> > look at other categories, all the links I have around these buttons[/color][/color]
direct to[color=blue][color=green]
> > their various categories.
> >
> > However, when I press these buttons, nothing happens.
> >
> > Did I forget to do something here?
> >
> > thanks for the help
> >
> >
> >[/color][/color] | | | | re: <a href> around an <asp:imagebutton> not working - need some help
Yes. This is the right way to do what you want.
If your button do not receive event, make sure you see something like this
in "Generated by form designer" part of code:
imgFood.Click += new ImageClickEventHandler(imgFoodClick);
The form designer should have added this to your code, but sometime for
unknown reason they're removed, so you should check it first.
"tperri" <tperri@discussions.microsoft.com> 级糶秎ン穝籇:93083307-EB6D-4E35-AEF8-B1F725A58003@microsoft.com...[color=blue]
>I also tried removing the <a href> tags around the ImageButtons and
>creating
> Click events for the buttons with
> Response.Redirect("savings.aspx?category=whatever" );
> and placed a breakpoint on these statements in my Click code and they
> don't
> event get executed.
>
> I must be missiong something really small here :P
>
> Thanks again
>
> "tperri" wrote:
>[color=green]
>> I have an HTML table with several fields like this:
>>
>> <A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood"
>> ImageUrl="images\buttons\btn-food-i.gif"
>> runat="server"></asp:imagebutton></A>
>>
>> When the user sees these buttons, they will currently be on the
>> savings.aspx?category=whatever page, and when they click another button
>> to
>> look at other categories, all the links I have around these buttons
>> direct to
>> their various categories.
>>
>> However, when I press these buttons, nothing happens.
>>
>> Did I forget to do something here?
>>
>> thanks for the help
>>
>>
>>[/color][/color] | | | | re: <a href> around an <asp:imagebutton> not working - need some help
What server-side functionality do you expect from the imagebutton? Can you
do just
<A href="Savings.aspx?category=Food"><:img
src="images\buttons\btn-food-i.gif"></A>
Eliyahu
"tperri" <tperri@discussions.microsoft.com> wrote in message
news:511D4666-B454-4510-95A2-0659D7F6B47E@microsoft.com...[color=blue]
> I have an HTML table with several fields like this:
>
> <A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood"
> ImageUrl="images\buttons\btn-food-i.gif"[/color]
runat="server"></asp:imagebutton></A>[color=blue]
>
> When the user sees these buttons, they will currently be on the
> savings.aspx?category=whatever page, and when they click another button to
> look at other categories, all the links I have around these buttons direct[/color]
to[color=blue]
> their various categories.
>
> However, when I press these buttons, nothing happens.
>
> Did I forget to do something here?
>
> thanks for the help
>
>
>[/color] | | | | re: <a href> around an <asp:imagebutton> not working - need some help
I need to change the images depending on the category so that the "actrive"
category has a different image differentiating it from the others; that is
why I'm using a server side control
"Eliyahu Goldin" wrote:
[color=blue]
> What server-side functionality do you expect from the imagebutton? Can you
> do just
>
> <A href="Savings.aspx?category=Food"><:img
> src="images\buttons\btn-food-i.gif"></A>
>
>
> Eliyahu
>
> "tperri" <tperri@discussions.microsoft.com> wrote in message
> news:511D4666-B454-4510-95A2-0659D7F6B47E@microsoft.com...[color=green]
> > I have an HTML table with several fields like this:
> >
> > <A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood"
> > ImageUrl="images\buttons\btn-food-i.gif"[/color]
> runat="server"></asp:imagebutton></A>[color=green]
> >
> > When the user sees these buttons, they will currently be on the
> > savings.aspx?category=whatever page, and when they click another button to
> > look at other categories, all the links I have around these buttons direct[/color]
> to[color=green]
> > their various categories.
> >
> > However, when I press these buttons, nothing happens.
> >
> > Did I forget to do something here?
> >
> > thanks for the help
> >
> >
> >[/color]
>
>
>[/color] | | | | re: <a href> around an <asp:imagebutton> not working - need some help
<td><asp:imagebutton id="imgHair" ImageUrl="images\buttons\btn-hair-i.gif"
runat="server"></asp:imagebutton></td>I do have the Event handlers... here is
my current html:
and my event handler:
this.imgHair.Click += new
System.Web.UI.ImageClickEventHandler(this.imgHair_ Click);
and my function:
private void imgHair_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
Response.Redirect("savings.aspx?category=Hair");
}
I'm baffled.
"Lau Lei Cheong" wrote:
[color=blue]
> Yes. This is the right way to do what you want.
>
> If your button do not receive event, make sure you see something like this
> in "Generated by form designer" part of code:
>
> imgFood.Click += new ImageClickEventHandler(imgFoodClick);
>
> The form designer should have added this to your code, but sometime for
> unknown reason they're removed, so you should check it first.
>
> "tperri" <tperri@discussions.microsoft.com> 录露录g漏贸露l楼贸路s禄D:93083307-EB6D-4E35-AEF8-B1F725A58003@microsoft.com...[color=green]
> >I also tried removing the <a href> tags around the ImageButtons and
> >creating
> > Click events for the buttons with
> > Response.Redirect("savings.aspx?category=whatever" );
> > and placed a breakpoint on these statements in my Click code and they
> > don't
> > event get executed.
> >
> > I must be missiong something really small here :P
> >
> > Thanks again
> >
> > "tperri" wrote:
> >[color=darkred]
> >> I have an HTML table with several fields like this:
> >>
> >> <A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood"
> >> ImageUrl="images\buttons\btn-food-i.gif"
> >> runat="server"></asp:imagebutton></A>
> >>
> >> When the user sees these buttons, they will currently be on the
> >> savings.aspx?category=whatever page, and when they click another button
> >> to
> >> look at other categories, all the links I have around these buttons
> >> direct to
> >> their various categories.
> >>
> >> However, when I press these buttons, nothing happens.
> >>
> >> Did I forget to do something here?
> >>
> >> thanks for the help
> >>
> >>
> >>[/color][/color]
>
>
>[/color] | | | | re: <a href> around an <asp:imagebutton> not working - need some help
That's fine. Just use asp:image instead of asp:imagebutton.
Eliyahu
"tperri" <tperri@discussions.microsoft.com> wrote in message
news:3B22EC02-4920-4842-8302-3B044A9789D0@microsoft.com...[color=blue]
> I need to change the images depending on the category so that the[/color]
"actrive"[color=blue]
> category has a different image differentiating it from the others; that is
> why I'm using a server side control
>
> "Eliyahu Goldin" wrote:
>[color=green]
> > What server-side functionality do you expect from the imagebutton? Can[/color][/color]
you[color=blue][color=green]
> > do just
> >
> > <A href="Savings.aspx?category=Food"><:img
> > src="images\buttons\btn-food-i.gif"></A>
> >
> >
> > Eliyahu
> >
> > "tperri" <tperri@discussions.microsoft.com> wrote in message
> > news:511D4666-B454-4510-95A2-0659D7F6B47E@microsoft.com...[color=darkred]
> > > I have an HTML table with several fields like this:
> > >
> > > <A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood"
> > > ImageUrl="images\buttons\btn-food-i.gif"[/color]
> > runat="server"></asp:imagebutton></A>[color=darkred]
> > >
> > > When the user sees these buttons, they will currently be on the
> > > savings.aspx?category=whatever page, and when they click another[/color][/color][/color]
button to[color=blue][color=green][color=darkred]
> > > look at other categories, all the links I have around these buttons[/color][/color][/color]
direct[color=blue][color=green]
> > to[color=darkred]
> > > their various categories.
> > >
> > > However, when I press these buttons, nothing happens.
> > >
> > > Did I forget to do something here?
> > >
> > > thanks for the help
> > >
> > >
> > >[/color]
> >
> >
> >[/color][/color] | | | | re: <a href> around an <asp:imagebutton> not working - need some help
Did not you first ask on an imagebutton inside a hyperlink? Why do you want
to redirect in the imagebutton event if the hyperlink does it for you? Make
your mind and navigate with only one control : either the button or the
link.
Eliyahu
"tperri" <tperri@discussions.microsoft.com> wrote in message
news:93386D43-D04B-49D0-9599-088AB1EEFB73@microsoft.com...[color=blue]
> <td><asp:imagebutton id="imgHair" ImageUrl="images\buttons\btn-hair-i.gif"
> runat="server"></asp:imagebutton></td>I do have the Event handlers... here[/color]
is[color=blue]
> my current html:
>
>
> and my event handler:
> this.imgHair.Click += new
> System.Web.UI.ImageClickEventHandler(this.imgHair_ Click);
>
> and my function:
> private void imgHair_Click(object sender,[/color]
System.Web.UI.ImageClickEventArgs e)[color=blue]
> {
> Response.Redirect("savings.aspx?category=Hair");
> }
>
> I'm baffled.
>
>
> "Lau Lei Cheong" wrote:
>[color=green]
> > Yes. This is the right way to do what you want.
> >
> > If your button do not receive event, make sure you see something like[/color][/color]
this[color=blue][color=green]
> > in "Generated by form designer" part of code:
> >
> > imgFood.Click += new ImageClickEventHandler(imgFoodClick);
> >
> > The form designer should have added this to your code, but sometime for
> > unknown reason they're removed, so you should check it first.
> >
> > "tperri" <tperri@discussions.microsoft.com>[/color][/color]
级糶秎ン穝籇:93083307-EB6D-4E35-AEF8-B1F725A58003@microsoft.com...[color=blue][color=green][color=darkred]
> > >I also tried removing the <a href> tags around the ImageButtons and
> > >creating
> > > Click events for the buttons with
> > > Response.Redirect("savings.aspx?category=whatever" );
> > > and placed a breakpoint on these statements in my Click code and they
> > > don't
> > > event get executed.
> > >
> > > I must be missiong something really small here :P
> > >
> > > Thanks again
> > >
> > > "tperri" wrote:
> > >
> > >> I have an HTML table with several fields like this:
> > >>
> > >> <A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood"
> > >> ImageUrl="images\buttons\btn-food-i.gif"
> > >> runat="server"></asp:imagebutton></A>
> > >>
> > >> When the user sees these buttons, they will currently be on the
> > >> savings.aspx?category=whatever page, and when they click another[/color][/color][/color]
button[color=blue][color=green][color=darkred]
> > >> to
> > >> look at other categories, all the links I have around these buttons
> > >> direct to
> > >> their various categories.
> > >>
> > >> However, when I press these buttons, nothing happens.
> > >>
> > >> Did I forget to do something here?
> > >>
> > >> thanks for the help
> > >>
> > >>
> > >>[/color]
> >
> >
> >[/color][/color] | | | | re: <a href> around an <asp:imagebutton> not working - need some help
That is what i originally did, and I was getting the same result - nothing.
It looked like it was posting back but it didn't go through the Page_Load
again. I set a break point there and nothing.
"Eliyahu Goldin" wrote:
[color=blue]
> That's fine. Just use asp:image instead of asp:imagebutton.
>
> Eliyahu
>
> "tperri" <tperri@discussions.microsoft.com> wrote in message
> news:3B22EC02-4920-4842-8302-3B044A9789D0@microsoft.com...[color=green]
> > I need to change the images depending on the category so that the[/color]
> "actrive"[color=green]
> > category has a different image differentiating it from the others; that is
> > why I'm using a server side control
> >
> > "Eliyahu Goldin" wrote:
> >[color=darkred]
> > > What server-side functionality do you expect from the imagebutton? Can[/color][/color]
> you[color=green][color=darkred]
> > > do just
> > >
> > > <A href="Savings.aspx?category=Food"><:img
> > > src="images\buttons\btn-food-i.gif"></A>
> > >
> > >
> > > Eliyahu
> > >
> > > "tperri" <tperri@discussions.microsoft.com> wrote in message
> > > news:511D4666-B454-4510-95A2-0659D7F6B47E@microsoft.com...
> > > > I have an HTML table with several fields like this:
> > > >
> > > > <A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood"
> > > > ImageUrl="images\buttons\btn-food-i.gif"
> > > runat="server"></asp:imagebutton></A>
> > > >
> > > > When the user sees these buttons, they will currently be on the
> > > > savings.aspx?category=whatever page, and when they click another[/color][/color]
> button to[color=green][color=darkred]
> > > > look at other categories, all the links I have around these buttons[/color][/color]
> direct[color=green][color=darkred]
> > > to
> > > > their various categories.
> > > >
> > > > However, when I press these buttons, nothing happens.
> > > >
> > > > Did I forget to do something here?
> > > >
> > > > thanks for the help
> > > >
> > > >
> > > >
> > >
> > >
> > >[/color][/color]
>
>
>[/color] | | | | re: <a href> around an <asp:imagebutton> not working - need some help
In your original post you had an imagebutton inside a hyperlink. I am
suggesting having an image, not imagebutton. What page do you expect
Page_Load to happen? If you user the hyperlink for navigating, there won't
be any postback to the original form. Browser will navigate straight to the
new url.
Eliyahu
"tperri" <tperri@discussions.microsoft.com> wrote in message
news:40A6467C-B58E-4BEC-A4EE-3A6E49EE487A@microsoft.com...[color=blue]
> That is what i originally did, and I was getting the same result -[/color]
nothing.[color=blue]
> It looked like it was posting back but it didn't go through the Page_Load
> again. I set a break point there and nothing.
>
> "Eliyahu Goldin" wrote:
>[color=green]
> > That's fine. Just use asp:image instead of asp:imagebutton.
> >
> > Eliyahu
> >
> > "tperri" <tperri@discussions.microsoft.com> wrote in message
> > news:3B22EC02-4920-4842-8302-3B044A9789D0@microsoft.com...[color=darkred]
> > > I need to change the images depending on the category so that the[/color]
> > "actrive"[color=darkred]
> > > category has a different image differentiating it from the others;[/color][/color][/color]
that is[color=blue][color=green][color=darkred]
> > > why I'm using a server side control
> > >
> > > "Eliyahu Goldin" wrote:
> > >
> > > > What server-side functionality do you expect from the imagebutton?[/color][/color][/color]
Can[color=blue][color=green]
> > you[color=darkred]
> > > > do just
> > > >
> > > > <A href="Savings.aspx?category=Food"><:img
> > > > src="images\buttons\btn-food-i.gif"></A>
> > > >
> > > >
> > > > Eliyahu
> > > >
> > > > "tperri" <tperri@discussions.microsoft.com> wrote in message
> > > > news:511D4666-B454-4510-95A2-0659D7F6B47E@microsoft.com...
> > > > > I have an HTML table with several fields like this:
> > > > >
> > > > > <A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood"
> > > > > ImageUrl="images\buttons\btn-food-i.gif"
> > > > runat="server"></asp:imagebutton></A>
> > > > >
> > > > > When the user sees these buttons, they will currently be on the
> > > > > savings.aspx?category=whatever page, and when they click another[/color]
> > button to[color=darkred]
> > > > > look at other categories, all the links I have around these[/color][/color][/color]
buttons[color=blue][color=green]
> > direct[color=darkred]
> > > > to
> > > > > their various categories.
> > > > >
> > > > > However, when I press these buttons, nothing happens.
> > > > >
> > > > > Did I forget to do something here?
> > > > >
> > > > > thanks for the help
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >[/color]
> >
> >
> >[/color][/color] | | | | re: <a href> around an <asp:imagebutton> not working - need some help
Ok, forget all the code I posted to you.
I replaced everything with an Image Button .... in the Click event of that
button I have a Response.Redirect("savings.aspx?category=Whatever" ); and that
doesn't work....
have any idea about that?
"Eliyahu Goldin" wrote:
[color=blue]
> In your original post you had an imagebutton inside a hyperlink. I am
> suggesting having an image, not imagebutton. What page do you expect
> Page_Load to happen? If you user the hyperlink for navigating, there won't
> be any postback to the original form. Browser will navigate straight to the
> new url.
>
> Eliyahu
>
> "tperri" <tperri@discussions.microsoft.com> wrote in message
> news:40A6467C-B58E-4BEC-A4EE-3A6E49EE487A@microsoft.com...[color=green]
> > That is what i originally did, and I was getting the same result -[/color]
> nothing.[color=green]
> > It looked like it was posting back but it didn't go through the Page_Load
> > again. I set a break point there and nothing.
> >
> > "Eliyahu Goldin" wrote:
> >[color=darkred]
> > > That's fine. Just use asp:image instead of asp:imagebutton.
> > >
> > > Eliyahu
> > >
> > > "tperri" <tperri@discussions.microsoft.com> wrote in message
> > > news:3B22EC02-4920-4842-8302-3B044A9789D0@microsoft.com...
> > > > I need to change the images depending on the category so that the
> > > "actrive"
> > > > category has a different image differentiating it from the others;[/color][/color]
> that is[color=green][color=darkred]
> > > > why I'm using a server side control
> > > >
> > > > "Eliyahu Goldin" wrote:
> > > >
> > > > > What server-side functionality do you expect from the imagebutton?[/color][/color]
> Can[color=green][color=darkred]
> > > you
> > > > > do just
> > > > >
> > > > > <A href="Savings.aspx?category=Food"><:img
> > > > > src="images\buttons\btn-food-i.gif"></A>
> > > > >
> > > > >
> > > > > Eliyahu
> > > > >
> > > > > "tperri" <tperri@discussions.microsoft.com> wrote in message
> > > > > news:511D4666-B454-4510-95A2-0659D7F6B47E@microsoft.com...
> > > > > > I have an HTML table with several fields like this:
> > > > > >
> > > > > > <A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood"
> > > > > > ImageUrl="images\buttons\btn-food-i.gif"
> > > > > runat="server"></asp:imagebutton></A>
> > > > > >
> > > > > > When the user sees these buttons, they will currently be on the
> > > > > > savings.aspx?category=whatever page, and when they click another
> > > button to
> > > > > > look at other categories, all the links I have around these[/color][/color]
> buttons[color=green][color=darkred]
> > > direct
> > > > > to
> > > > > > their various categories.
> > > > > >
> > > > > > However, when I press these buttons, nothing happens.
> > > > > >
> > > > > > Did I forget to do something here?
> > > > > >
> > > > > > thanks for the help
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > >
> > >
> > >[/color][/color]
>
>
>[/color] | | | | re: <a href> around an <asp:imagebutton> not working - need some help
Then, give your server-side form an id and try to type the following line in
the address bar of your browser after your page is opened.
javascript:window.alert(document.getElementById('i mgHair').form.id)
If the browser popups undefined/null/<blank> but not your form's id, you
should consider checking to see if all html tags(especially <form> and
<table>)are properly closed and not overlapped. In this case the imagebutton
is not attached to the postbackable form so not postback event can be fired.
"tperri" <tperri@discussions.microsoft.com> 级糶秎ン穝籇:93386D43-D04B-49D0-9599-088AB1EEFB73@microsoft.com...[color=blue]
> <td><asp:imagebutton id="imgHair" ImageUrl="images\buttons\btn-hair-i.gif"
> runat="server"></asp:imagebutton></td>I do have the Event handlers... here
> is
> my current html:
>
>
> and my event handler:
> this.imgHair.Click += new
> System.Web.UI.ImageClickEventHandler(this.imgHair_ Click);
>
> and my function:
> private void imgHair_Click(object sender,
> System.Web.UI.ImageClickEventArgs e)
> {
> Response.Redirect("savings.aspx?category=Hair");
> }
>
> I'm baffled.
>
>
> "Lau Lei Cheong" wrote:
>[color=green]
>> Yes. This is the right way to do what you want.
>>
>> If your button do not receive event, make sure you see something like
>> this
>> in "Generated by form designer" part of code:
>>
>> imgFood.Click += new ImageClickEventHandler(imgFoodClick);
>>
>> The form designer should have added this to your code, but sometime for
>> unknown reason they're removed, so you should check it first.
>>
>> "tperri" <tperri@discussions.microsoft.com> ???gco?los?D:93083307-EB6D-4E35-AEF8-B1F725A58003@microsoft.com...
>>[color=darkred]
>> >I also tried removing the <a href> tags around the ImageButtons and
>> >creating
>> > Click events for the buttons with
>> > Response.Redirect("savings.aspx?category=whatever" );
>> > and placed a breakpoint on these statements in my Click code and they
>> > don't
>> > event get executed.
>> >
>> > I must be missiong something really small here :P
>> >
>> > Thanks again
>> >
>> > "tperri" wrote:
>> >
>> >> I have an HTML table with several fields like this:
>> >>
>> >> <A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood"
>> >> ImageUrl="images\buttons\btn-food-i.gif"
>> >> runat="server"></asp:imagebutton></A>
>> >>
>> >> When the user sees these buttons, they will currently be on the
>> >> savings.aspx?category=whatever page, and when they click another
>> >> button
>> >> to
>> >> look at other categories, all the links I have around these buttons
>> >> direct to
>> >> their various categories.
>> >>
>> >> However, when I press these buttons, nothing happens.
>> >>
>> >> Did I forget to do something here?
>> >>
>> >> thanks for the help
>> >>
>> >>
>> >>[/color]
>>
>>
>>[/color][/color] | | | | re: <a href> around an <asp:imagebutton> not working - need some help
I guess it's not a good sign if I do this.. and nothing happens.. and in the
lower bar of IE I get the yellow exclamation point that says error on page :)
"Lau Lei Cheong" wrote:
[color=blue]
> Then, give your server-side form an id and try to type the following line in
> the address bar of your browser after your page is opened.
>
> javascript:window.alert(document.getElementById('i mgHair').form.id)
>
> If the browser popups undefined/null/<blank> but not your form's id, you
> should consider checking to see if all html tags(especially <form> and
> <table>)are properly closed and not overlapped. In this case the imagebutton
> is not attached to the postbackable form so not postback event can be fired.
>
> "tperri" <tperri@discussions.microsoft.com> 录露录g漏贸露l楼贸路s禄D:93386D43-D04B-49D0-9599-088AB1EEFB73@microsoft.com...[color=green]
> > <td><asp:imagebutton id="imgHair" ImageUrl="images\buttons\btn-hair-i.gif"
> > runat="server"></asp:imagebutton></td>I do have the Event handlers... here
> > is
> > my current html:
> >
> >
> > and my event handler:
> > this.imgHair.Click += new
> > System.Web.UI.ImageClickEventHandler(this.imgHair_ Click);
> >
> > and my function:
> > private void imgHair_Click(object sender,
> > System.Web.UI.ImageClickEventArgs e)
> > {
> > Response.Redirect("savings.aspx?category=Hair");
> > }
> >
> > I'm baffled.
> >
> >
> > "Lau Lei Cheong" wrote:
> >[color=darkred]
> >> Yes. This is the right way to do what you want.
> >>
> >> If your button do not receive event, make sure you see something like
> >> this
> >> in "Generated by form designer" part of code:
> >>
> >> imgFood.Click += new ImageClickEventHandler(imgFoodClick);
> >>
> >> The form designer should have added this to your code, but sometime for
> >> unknown reason they're removed, so you should check it first.
> >>
> >> "tperri" <tperri@discussions.microsoft.com> ???gco?l垄Do隆Ps?D:93083307-EB6D-4E35-AEF8-B1F725A58003@microsoft.com...
> >>
> >> >I also tried removing the <a href> tags around the ImageButtons and
> >> >creating
> >> > Click events for the buttons with
> >> > Response.Redirect("savings.aspx?category=whatever" );
> >> > and placed a breakpoint on these statements in my Click code and they
> >> > don't
> >> > event get executed.
> >> >
> >> > I must be missiong something really small here :P
> >> >
> >> > Thanks again
> >> >
> >> > "tperri" wrote:
> >> >
> >> >> I have an HTML table with several fields like this:
> >> >>
> >> >> <A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood"
> >> >> ImageUrl="images\buttons\btn-food-i.gif"
> >> >> runat="server"></asp:imagebutton></A>
> >> >>
> >> >> When the user sees these buttons, they will currently be on the
> >> >> savings.aspx?category=whatever page, and when they click another
> >> >> button
> >> >> to
> >> >> look at other categories, all the links I have around these buttons
> >> >> direct to
> >> >> their various categories.
> >> >>
> >> >> However, when I press these buttons, nothing happens.
> >> >>
> >> >> Did I forget to do something here?
> >> >>
> >> >> thanks for the help
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>[/color][/color]
>
>
>[/color] |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,510 network members.
|