473,382 Members | 1,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

ASP.NET 1.1 TextBox OnClick Event

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
5 13927
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jim Mitchell | last post by:
I have some code behind that generates 10 imagebutton controls.... I can not seem to figure out how to trap the onclick event for each image and determine which image was clicked. Can someone...
2
by: Andreas Knollmann | last post by:
Hi, I create an object like this: var cell = document.createElement("td"). It doesn't have to be cell. I want this cell to use the onclick event. What doesn't work in the IE as well as with...
3
by: f1crazed | last post by:
Hello, I am wanting to fire the onClick event of button1 by pressing button2. Does anyone have a clue if this is even posible? If so PLEASE HELP!! Thanks.
17
by: abs | last post by:
My element: <span onclick="alert('test')" id="mySpan">test</span> Let's say that I don't know what is in this span's onclick event. Is it possible to add another action to this element's onclick...
5
by: moondaddy | last post by:
I have a <a> element in a datagrid which wraps some asp.net labels. this element also has an onclick event which does not fire in netscape 6 (and perhaps other browsers for all I know...). Below...
1
by: Joshua Weir | last post by:
Hi, Is there an onclick event function for hyperlink buttons? I couldnt seem to find one. How else would i do checks at the client side (such as if correct information is displayed in a textbox...
14
by: teddysnips | last post by:
WINDOWS FORMS I've a form that has a textbox that allows the user to enter a string. On the LostFocus event, the textbox formats the string into a preferred format. However, if the user...
3
by: Michael_R_Banks | last post by:
I'm trying to dynamically build a table that allows users to remove rows when they click a corresponding button. For some reason, whenever I add the button to the table, it never fires the onclick...
1
by: Claudiu | last post by:
Hi, I have the following code and no matter what I do onclick event for button is not firing. I tried deleting the button, the pages. Redid the code. Moved the web project to a different...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.