ASP.NET 1.1 TextBox OnClick Event

S

Stuart Shay

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
 
E

Eliyahu Goldin

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?
 
S

Stuart Shay

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 said:
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 said:
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
 
E

Eliyahu Goldin

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 said:
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 said:
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 said:
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
 
S

Stuart Shay

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 said:
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 said:
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 said:
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]


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
 
E

Eliyahu Goldin

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 said:
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 said:
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 said:
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


message 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]


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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top