473,566 Members | 3,342 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Server side functionality

Hi All,

I have an html button on .aspx page.

<INPUT class="sbttn" id="btnComplete 0" onclick="onComp lete
()" type="button" value="Mark Completed"
name="btnComple te0">

When the user clicks on the html button the OnComplete
function is called.

<script language="javas cript">
function onComplete()
{

// Client side code

// Clicking the server control via code
WorkItemForm.bt nComplete.click ();

}
</script>
I need to perform some server side functinality whenever
user clicks the html button. So I place a hidden server
control (id = btnComplete) on the .aspx page. In the
client side code I automatically click the server control
( WorkItemForm.bt nComplete.click ();).

On the click event of hidden server control, I write the
server side code in .aspx.cs page.

// Code in .aspx.cs page

private void btnComplete_Cli ck(object sender,
System.EventArg s e)
{
// Calling Server Side Code
}

I am using btnComplete server control as an intermediate
to perform server side functionality.

Problem:

I want to get rid of server control.
Is there a way to perform server side functionality
directly without using server control.

I tried document.FormNa me.Submit();

This doesn't work. Is there some other way to do so?

Thanks & Regards,
-Reetu


Nov 17 '05 #1
3 1587
Hi Reetu,

Here's some VB code that might help you. It uses the submit() method. Not sure
why it didn't work for you.

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArg s) _
Handles MyBase.Load
Literal1.Text = "<script>functi on
onCompleted(){a lert('action'); document.forms[0].submit();}</script>"
If IsPostBack Then
Label2.Text = "I was posted back at: " & Now.TimeOfDay.T oString
End If
End Sub
<form id="Form1" method="post" runat="server">
<p>
<asp:textbox id="TextBox1" runat="server"> </asp:textbox></p>
<p>
<asp:label id="Label2" runat="server"> </asp:label></p>
<p>
<asp:label id="Label1" runat="server"> </asp:label></p>
<p>
<asp:literal id="Literal1" runat="server"> </asp:literal></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<input class="sbttn" id="btnComplete 0" onclick="onComp leted()"
type="button" value="Mark Completed"
name="btnComple te0">
</form>
"Reetu" <re***@ascentn. com> wrote in message
news:06******** *************** *****@phx.gbl.. .
Hi All,

I have an html button on .aspx page.

<INPUT class="sbttn" id="btnComplete 0" onclick="onComp lete
()" type="button" value="Mark Completed"
name="btnComple te0">

When the user clicks on the html button the OnComplete
function is called.

<script language="javas cript">
function onComplete()
{

// Client side code

// Clicking the server control via code
WorkItemForm.bt nComplete.click ();

}
</script>
I need to perform some server side functinality whenever
user clicks the html button. So I place a hidden server
control (id = btnComplete) on the .aspx page. In the
client side code I automatically click the server control
( WorkItemForm.bt nComplete.click ();).

On the click event of hidden server control, I write the
server side code in .aspx.cs page.

// Code in .aspx.cs page

private void btnComplete_Cli ck(object sender,
System.EventArg s e)
{
// Calling Server Side Code
}

I am using btnComplete server control as an intermediate
to perform server side functionality.

Problem:

I want to get rid of server control.
Is there a way to perform server side functionality
directly without using server control.

I tried document.FormNa me.Submit();

This doesn't work. Is there some other way to do so?

Thanks & Regards,
-Reetu



Nov 17 '05 #2
Ram
When your page is loaded, checl the HTML source of your page. Your
hidden button will not be rendered at all.

Instead, you can convert your button to a aspx button and add
Javascript event to it from the code behind using

Add this line of code to your page load event.
ButtonName.Attr ibutes.add("onC lick","return onComplete()")

Now when you click on your button it will raise the onclick event on
the client side and will call onComplete Javascript function. Inside
the Javascript if you return false, the form will not be submitted and
the server side event of your button will not fire. If you return
true, form will be submitted to the server and your button's onclick
event will be fired on the server.

----
Ram

"Reetu" <re***@ascentn. com> wrote in message news:<06******* *************** ******@phx.gbl> ...
Hi All,

I have an html button on .aspx page.

<INPUT class="sbttn" id="btnComplete 0" onclick="onComp lete
()" type="button" value="Mark Completed"
name="btnComple te0">

When the user clicks on the html button the OnComplete
function is called.

<script language="javas cript">
function onComplete()
{

// Client side code

// Clicking the server control via code
WorkItemForm.bt nComplete.click ();

}
</script>
I need to perform some server side functinality whenever
user clicks the html button. So I place a hidden server
control (id = btnComplete) on the .aspx page. In the
client side code I automatically click the server control
( WorkItemForm.bt nComplete.click ();).

On the click event of hidden server control, I write the
server side code in .aspx.cs page.

// Code in .aspx.cs page

private void btnComplete_Cli ck(object sender,
System.EventArg s e)
{
// Calling Server Side Code
}

I am using btnComplete server control as an intermediate
to perform server side functionality.

Problem:

I want to get rid of server control.
Is there a way to perform server side functionality
directly without using server control.

I tried document.FormNa me.Submit();

This doesn't work. Is there some other way to do so?

Thanks & Regards,
-Reetu

Nov 17 '05 #3

Thanks a lot, it works.

Regards,
-Reetu
-----Original Message-----
When your page is loaded, checl the HTML source of your page. Yourhidden button will not be rendered at all.

Instead, you can convert your button to a aspx button and addJavascript event to it from the code behind using

Add this line of code to your page load event.
ButtonName.Att ributes.add("on Click","return onComplete()")

Now when you click on your button it will raise the onclick event onthe client side and will call onComplete Javascript function. Insidethe Javascript if you return false, the form will not be submitted andthe server side event of your button will not fire. If you returntrue, form will be submitted to the server and your button's onclickevent will be fired on the server.

----
Ram

"Reetu" <re***@ascentn. com> wrote in message

news:<06******* *************** ******@phx.gbl> ...
Hi All,

I have an html button on .aspx page.

<INPUT class="sbttn" id="btnComplete 0" onclick="onComp lete ()" type="button" value="Mark Completed"
name="btnComple te0">

When the user clicks on the html button the OnComplete
function is called.

<script language="javas cript">
function onComplete()
{

// Client side code

// Clicking the server control via code
WorkItemForm.bt nComplete.click ();

}
</script>
I need to perform some server side functinality whenever user clicks the html button. So I place a hidden server
control (id = btnComplete) on the .aspx page. In the
client side code I automatically click the server control ( WorkItemForm.bt nComplete.click ();).

On the click event of hidden server control, I write the server side code in .aspx.cs page.

// Code in .aspx.cs page

private void btnComplete_Cli ck(object sender,
System.EventArg s e)
{
// Calling Server Side Code
}

I am using btnComplete server control as an intermediate to perform server side functionality.

Problem:

I want to get rid of server control.
Is there a way to perform server side functionality
directly without using server control.

I tried document.FormNa me.Submit();

This doesn't work. Is there some other way to do so?

Thanks & Regards,
-Reetu

.

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1890
by: Steve Bywaters | last post by:
(In my transition from ASP to ASP.NET) *When* would I use at "runat server" tag on a button, as opposed to a normal button? If I set up a search area on a page, with a 'Search' button that applies the entered items to the db - is that best as a normal button or server control.... and why? Steve
2
7412
by: Kumar | last post by:
Hi Folks, I would like to develop one custom application using asp.net,C#,SQL server for tracking all our company servers. Most of the functionality is similar to HP Systems Insight Manager (http://h18013.www1.hp.com/products/servers/management/hpsim/) I would like to store as much information as we can about server.
5
3576
by: serge calderara | last post by:
Dear all, I am new in asp.net and prepare myself for exam I still have dificulties to understand the difference between server control and HTML control. Okey things whcih are clear are the fact that for server control component , code is running on the server side. But if I take as example a Label. I place on a webform an HTM label...
10
2027
by: Ben | last post by:
Hi, I made an application in classic asp (reservation of books and video stuffs for students) and want to migrate to asp.net. The user has to chose a date, then pushung on a submit button. The whole day is then displayed in cels of a table. The user has then to click in a cel representing a hour of the day and an object (book ..), and...
1
1092
by: MPA | last post by:
Hi, We are a small company with no experience in web development. We are considering translating our main client-server product into web application or web service using DOT.NET. Our app is basically a tree representing the employees and departments of our customers with some tabs where the corresponding info for each node is presented. Our...
2
6937
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of attending interviews. If you own a company best way to judge if the candidate is worth of it. http://www.questpond.com/InterviewRatingSheet.zip
9
2371
by: jazzslider | last post by:
I have a headache. I've done a LOT of research lately into XForms, and I am thoroughly convinced that a good implementation of this technology would help me immensely in converting my department's paper forms into interactive online systems. There are a couple of problems I'm facing that I'm hoping someone here could help with. Number...
12
1705
by: Peter Michaux | last post by:
I'm writing a server-side web application framework using Mozilla's Rhino JavaScript engine. My two primary motivations are so I can write code on server and client sides without needing to switch gears mentally and so that the server and client can share code. The types of code sharing I know I can use immediately are form validations and...
0
7673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7893
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8109
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7645
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7953
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6263
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
2085
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1202
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.