By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,972 Members | 911 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,972 IT Pros & Developers. It's quick & easy.

ASP.NET 1.1 TextBox OnClick Event

P: n/a
Hello All

I am working on ASP.NET 1.1 Custom Pager that allows a User to Enter a
Number in a TextBox and go to the page selected.

Since the OnClick Event does not work in ASP.NET 1.1 for a TextBox

I want to use a hidden button to fire when the Onclick Event is fired for
the TextBox.

How do I Set the Textbox so it will fire the btnPager or Server Side Event ?

<asp:textbox id="txtPageCount" OnClick=" *** Fire btnPager/Server Side Event
***" runat="server"></asp:textbox>
<asp:Button ID="btnPager" Visible="False" Runat="Server"></asp:Button>

Thanks
Stuart
Nov 5 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Stuart,

You can handle onclick event only on client side. A javascript event handler
can submit the form which is equivalent to a postback.

It is not clear what functionality you are trying to achieve. Onclick event
will fire when the user left-clicks the control with the mouse. Do you want
the click to fire a server-side event?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Stuart Shay" <ss***@yahoo.comwrote in message
news:Oh**************@TK2MSFTNGP04.phx.gbl...
Hello All

I am working on ASP.NET 1.1 Custom Pager that allows a User to Enter a
Number in a TextBox and go to the page selected.

Since the OnClick Event does not work in ASP.NET 1.1 for a TextBox

I want to use a hidden button to fire when the Onclick Event is fired for
the TextBox.

How do I Set the Textbox so it will fire the btnPager or Server Side Event
?

<asp:textbox id="txtPageCount" OnClick=" *** Fire btnPager/Server Side
Event ***" runat="server"></asp:textbox>
<asp:Button ID="btnPager" Visible="False" Runat="Server"></asp:Button>

Thanks
Stuart

Nov 5 '06 #2

P: n/a
Eliyahu

Below is a link for a sample that I created, On the Right of the pager (By
Total) I have a small button that handles the paging, if you enter a number
in the textbox and click the button the correct page is selected.

I want the textbox so when a user OnClicks the text box the correct page is
selected.

How can I wire up a Clien Side Event to Server Side code?

http://firmportal.com/DataGridTest/DataGridCache.aspx

Thanks
Stuart
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:e6**************@TK2MSFTNGP04.phx.gbl...
Stuart,

You can handle onclick event only on client side. A javascript event
handler can submit the form which is equivalent to a postback.

It is not clear what functionality you are trying to achieve. Onclick
event will fire when the user left-clicks the control with the mouse. Do
you want the click to fire a server-side event?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Stuart Shay" <ss***@yahoo.comwrote in message
news:Oh**************@TK2MSFTNGP04.phx.gbl...
>Hello All

I am working on ASP.NET 1.1 Custom Pager that allows a User to Enter a
Number in a TextBox and go to the page selected.

Since the OnClick Event does not work in ASP.NET 1.1 for a TextBox

I want to use a hidden button to fire when the Onclick Event is fired for
the TextBox.

How do I Set the Textbox so it will fire the btnPager or Server Side
Event ?

<asp:textbox id="txtPageCount" OnClick=" *** Fire btnPager/Server Side
Event ***" runat="server"></asp:textbox>
<asp:Button ID="btnPager" Visible="False" Runat="Server"></asp:Button>

Thanks
Stuart


Nov 5 '06 #3

P: n/a
I am still uncertain on what you want to achieve. You already have a textbox
there. What is the scenario? The user enters a number, what is the next
action? Hitting Enter? Clicking some other control? You have to tell the
program somehow that the user has finished entering the number and now you
want to switch to that page.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Stuart Shay" <ss***@yahoo.comwrote in message
news:uT**************@TK2MSFTNGP04.phx.gbl...
Eliyahu

Below is a link for a sample that I created, On the Right of the pager (By
Total) I have a small button that handles the paging, if you enter a
number in the textbox and click the button the correct page is selected.

I want the textbox so when a user OnClicks the text box the correct page
is selected.

How can I wire up a Clien Side Event to Server Side code?

http://firmportal.com/DataGridTest/DataGridCache.aspx

Thanks
Stuart
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:e6**************@TK2MSFTNGP04.phx.gbl...
>Stuart,

You can handle onclick event only on client side. A javascript event
handler can submit the form which is equivalent to a postback.

It is not clear what functionality you are trying to achieve. Onclick
event will fire when the user left-clicks the control with the mouse. Do
you want the click to fire a server-side event?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Stuart Shay" <ss***@yahoo.comwrote in message
news:Oh**************@TK2MSFTNGP04.phx.gbl...
>>Hello All

I am working on ASP.NET 1.1 Custom Pager that allows a User to Enter a
Number in a TextBox and go to the page selected.

Since the OnClick Event does not work in ASP.NET 1.1 for a TextBox

I want to use a hidden button to fire when the Onclick Event is fired
for the TextBox.

How do I Set the Textbox so it will fire the btnPager or Server Side
Event ?

<asp:textbox id="txtPageCount" OnClick=" *** Fire btnPager/Server Side
Event ***" runat="server"></asp:textbox>
<asp:Button ID="btnPager" Visible="False" Runat="Server"></asp:Button>

Thanks
Stuart



Nov 5 '06 #4

P: n/a
Eliyahu

I want to have the functionality as shown on this page
http://firmportal.com/DataGridTest/DataGridPager.aspx

If you enter a number and press enter it will go to the selected page.

The problem is in ASP.NET 1.1 the onclick="txtPageCount_TextChanged" does
not work as server side call back event (This works on ASP.NET 2.0).

I want to have the text box on so when i call a client side
onclick="txtPageCount_TextChanged" I can call a asp.net server side
JavaScript Callback. A solution that was recommended to me was to create a
Button Set the Visibility to hidden and just have the Client Side JavaScript
call the hidden button event.

http://firmportal.com/DataGridTest/DataGridCache.aspx

So my question, Is it possible to use Client Side JavaScript to call a
ASP.NET Server Side WebControl Event.

Help in finding this solution would be much appreciated

Thanks
Stuart
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:OL**************@TK2MSFTNGP03.phx.gbl...
>I am still uncertain on what you want to achieve. You already have a
textbox there. What is the scenario? The user enters a number, what is the
next action? Hitting Enter? Clicking some other control? You have to tell
the program somehow that the user has finished entering the number and now
you want to switch to that page.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Stuart Shay" <ss***@yahoo.comwrote in message
news:uT**************@TK2MSFTNGP04.phx.gbl...
>Eliyahu

Below is a link for a sample that I created, On the Right of the pager
(By Total) I have a small button that handles the paging, if you enter a
number in the textbox and click the button the correct page is selected.

I want the textbox so when a user OnClicks the text box the correct page
is selected.

How can I wire up a Clien Side Event to Server Side code?

http://firmportal.com/DataGridTest/DataGridCache.aspx

Thanks
Stuart
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:e6**************@TK2MSFTNGP04.phx.gbl...
>>Stuart,

You can handle onclick event only on client side. A javascript event
handler can submit the form which is equivalent to a postback.

It is not clear what functionality you are trying to achieve. Onclick
event will fire when the user left-clicks the control with the mouse. Do
you want the click to fire a server-side event?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Stuart Shay" <ss***@yahoo.comwrote in message
news:Oh**************@TK2MSFTNGP04.phx.gbl...
Hello All

I am working on ASP.NET 1.1 Custom Pager that allows a User to Enter a
Number in a TextBox and go to the page selected.

Since the OnClick Event does not work in ASP.NET 1.1 for a TextBox

I want to use a hidden button to fire when the Onclick Event is fired
for the TextBox.

How do I Set the Textbox so it will fire the btnPager or Server Side
Event ?

<asp:textbox id="txtPageCount" OnClick=" *** Fire btnPager/Server Side
Event ***" runat="server"></asp:textbox>
<asp:Button ID="btnPager" Visible="False" Runat="Server"></asp:Button>

Thanks
Stuart



Nov 6 '06 #5

P: n/a
Stuart,

A javascript call myForm.submit () is equivalent to a postback. Now you need
to tell the server side what action you want it to do. You want to achieve
it by raising a server-side event. But you don't have to mimic any events.
You introduce a hidden input control for 2-way command exchange between the
client and the server:

On the client (javascript)
<script>
function txtPageCount_TextChanged()
{
myForm.inhAction.value = "CHANGEPAGE";
myForm.submit();
}
</script>

<input type='hidden" runat="server" id="inhAction" />

On the server side in the Page_Load method check the value of the inhAction
and run the appropriate code.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Stuart Shay" <ss***@yahoo.comwrote in message
news:ew**************@TK2MSFTNGP03.phx.gbl...
Eliyahu

I want to have the functionality as shown on this page
http://firmportal.com/DataGridTest/DataGridPager.aspx

If you enter a number and press enter it will go to the selected page.

The problem is in ASP.NET 1.1 the onclick="txtPageCount_TextChanged" does
not work as server side call back event (This works on ASP.NET 2.0).

I want to have the text box on so when i call a client side
onclick="txtPageCount_TextChanged" I can call a asp.net server side
JavaScript Callback. A solution that was recommended to me was to create a
Button Set the Visibility to hidden and just have the Client Side
JavaScript call the hidden button event.

http://firmportal.com/DataGridTest/DataGridCache.aspx

So my question, Is it possible to use Client Side JavaScript to call a
ASP.NET Server Side WebControl Event.

Help in finding this solution would be much appreciated

Thanks
Stuart
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:OL**************@TK2MSFTNGP03.phx.gbl...
>>I am still uncertain on what you want to achieve. You already have a
textbox there. What is the scenario? The user enters a number, what is the
next action? Hitting Enter? Clicking some other control? You have to tell
the program somehow that the user has finished entering the number and now
you want to switch to that page.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Stuart Shay" <ss***@yahoo.comwrote in message
news:uT**************@TK2MSFTNGP04.phx.gbl...
>>Eliyahu

Below is a link for a sample that I created, On the Right of the pager
(By Total) I have a small button that handles the paging, if you enter a
number in the textbox and click the button the correct page is selected.

I want the textbox so when a user OnClicks the text box the correct page
is selected.

How can I wire up a Clien Side Event to Server Side code?

http://firmportal.com/DataGridTest/DataGridCache.aspx

Thanks
Stuart
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:e6**************@TK2MSFTNGP04.phx.gbl...
Stuart,

You can handle onclick event only on client side. A javascript event
handler can submit the form which is equivalent to a postback.

It is not clear what functionality you are trying to achieve. Onclick
event will fire when the user left-clicks the control with the mouse.
Do you want the click to fire a server-side event?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Stuart Shay" <ss***@yahoo.comwrote in message
news:Oh**************@TK2MSFTNGP04.phx.gbl...
Hello All
>
I am working on ASP.NET 1.1 Custom Pager that allows a User to Enter a
Number in a TextBox and go to the page selected.
>
Since the OnClick Event does not work in ASP.NET 1.1 for a TextBox
>
I want to use a hidden button to fire when the Onclick Event is fired
for the TextBox.
>
How do I Set the Textbox so it will fire the btnPager or Server Side
Event ?
>
<asp:textbox id="txtPageCount" OnClick=" *** Fire btnPager/Server Side
Event ***" runat="server"></asp:textbox>
<asp:Button ID="btnPager" Visible="False" Runat="Server"></asp:Button>
>
Thanks
Stuart
>




Nov 6 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.