473,405 Members | 2,261 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,405 software developers and data experts.

Design question

I have a button on my ASP.NET 2.0 web page labelled "Copy to
Clipboard" which must use server side code to format some data in a
specific manner and then copy it to the client clipboard so it can be
pasted into another application. Initially I planned to have the
server-side code put the data string into a cookie and then use a
client-side Javascript function referenced in the button's
OnClientClick attribute to copy the contents of the cookie to the
client clipboard. However, to my display I've just figured out that
client-side code is always executed before server events.
Can someone give me an idea of how I can achieve what I need to be
able to do. Thanks.

Peter,

Jul 15 '07 #1
4 2141
On Jul 15, 4:28 pm, Peter <pete...@circle-consulting.co.nzwrote:
I have a button on my ASP.NET 2.0 web page labelled "Copy to
Clipboard" which must use server side code to format some data in a
specific manner and then copy it to the client clipboard so it can be
pasted into another application. Initially I planned to have the
server-side code put the data string into a cookie and then use a
client-side Javascript function referenced in the button's
OnClientClick attribute to copy the contents of the cookie to the
client clipboard. However, to my display I've just figured out that
client-side code is always executed before server events.
Can someone give me an idea of how I can achieve what I need to be
able to do. Thanks.

Peter,
hi,
you can think about ajax. Format your clipboard data in a ajax call
and in call back put in in clipboard
like if you use ajax pro...
//html file
<input type="button" class="button" onclick="SubmitForFormat();"
value="Finish">
//js file
function SubmitRegistrationAJ()
{
PageMethods.SubmitForFormat(callBack_CopyToClipboa rd);
}

function callBack_CopyToClipboard(reselt)
{
//lets say
window.clipboardData.setData('text', reselt);
}

//server side code cs file
[WebMethod]
public static string SubmitForFormat()
{
return frmatedstring;
}

or you can use hidden field and onbody load always check if anything
in hidden field and then copy it to clipboard

nahid
http://nahidulkibria.blogspot.com/
http://www.kaz.com.bd

Jul 15 '07 #2
On Jul 15, 11:16 pm, nahid <nahid...@gmail.comwrote:
On Jul 15, 4:28 pm, Peter <pete...@circle-consulting.co.nzwrote:
I have a button on my ASP.NET 2.0 web page labelled "Copy to
Clipboard" which must use server side code to format some data in a
specific manner and then copy it to the client clipboard so it can be
pasted into another application. Initially I planned to have the
server-side code put the data string into a cookie and then use a
client-side Javascript function referenced in the button's
OnClientClick attribute to copy the contents of the cookie to the
client clipboard. However, to my display I've just figured out that
client-side code is always executed before server events.
Can someone give me an idea of how I can achieve what I need to be
able to do. Thanks.
Peter,

hi,
you can think about ajax. Format your clipboard data in a ajax call
and in call back put in in clipboard
like if you use ajax pro...
//html file
<input type="button" class="button" onclick="SubmitForFormat();"
value="Finish">
//js file
function SubmitRegistrationAJ()
{
PageMethods.SubmitForFormat(callBack_CopyToClipboa rd);

}

function callBack_CopyToClipboard(reselt)
{
//lets say
window.clipboardData.setData('text', reselt);

}

//server side code cs file
[WebMethod]
public static string SubmitForFormat()
{
return frmatedstring;
}

or you can use hidden field and onbody load always check if anything
in hidden field and then copy it to clipboard

nahidhttp://nahidulkibria.blogspot.com/http://www.kaz.com.bd
Thanks. I've not dabbled with AJAX before so will look into what
you've suggested. Is the "ajax pro" you mention part of ASP.NET or
something I must add to my development environment? I've just had a
quick look on MSDN and it seems that ASP.NET 2.0 does have some AJAX
capability. Thanks for your help.

Jul 15 '07 #3
On Jul 16, 1:55 am, Peter <pete...@circle-consulting.co.nzwrote:
On Jul 15, 11:16 pm, nahid <nahid...@gmail.comwrote:


On Jul 15, 4:28 pm, Peter <pete...@circle-consulting.co.nzwrote:
I have a button on my ASP.NET 2.0 web page labelled "Copy to
Clipboard" which must use server side code to format some data in a
specific manner and then copy it to the client clipboard so it can be
pasted into another application. Initially I planned to have the
server-side code put the data string into a cookie and then use a
client-side Javascript function referenced in the button's
OnClientClick attribute to copy the contents of the cookie to the
client clipboard. However, to my display I've just figured out that
client-side code is always executed before server events.
Can someone give me an idea of how I can achieve what I need to be
able to do. Thanks.
Peter,
hi,
you can think about ajax. Format your clipboard data in a ajax call
and in call back put in in clipboard
like if you use ajax pro...
//html file
<input type="button" class="button" onclick="SubmitForFormat();"
value="Finish">
//js file
function SubmitRegistrationAJ()
{
PageMethods.SubmitForFormat(callBack_CopyToClipboa rd);
}
function callBack_CopyToClipboard(reselt)
{
//lets say
window.clipboardData.setData('text', reselt);
}
//server side code cs file
[WebMethod]
public static string SubmitForFormat()
{
return frmatedstring;
}
or you can use hidden field and onbody load always check if anything
in hidden field and then copy it to clipboard
nahidhttp://nahidulkibria.blogspot.com/http://www.kaz.com.bd

Thanks. I've not dabbled with AJAX before so will look into what
you've suggested. Is the "ajax pro" you mention part of ASP.NET or
something I must add to my development environment? I've just had a
quick look on MSDN and it seems that ASP.NET 2.0 does have some AJAX
capability. Thanks for your help.- Hide quoted text -

- Show quoted text -
hi,
im talk about http://www.codeplex.com/AjaxPro/ AJAX frameworks to
make you pages ajax enable.
simply think PageMethods as web service and after call back result
you put data to clipboard.
if you consider microsoft ajax framework (http://ajax.asp.net/) try
following way...i'm not try this but should work in your case

<script type="text/javascript">

function AfterPostback()
{
//lets say
window.clipboardData.setData('text', reselt);
}

function PageRequestManagerPropertyChanged(sender, args)
{
if (args.get_propertyName() == "inPostBack")
{
if (!$object("_PageRequestManager").get_inPostBack())
AfterPostback();
}
}
function pageLoad()
{
$object("_PageRequestManager").propertyChanged.add (PageRequestManagerPropertyChanged);
}
</script>

<div>

<atlas:ScriptManager EnablePartialRendering="true" ID="ScriptManager1"
runat="server">

</atlas:ScriptManager>

<atlas:UpdatePanel runat="server" Mode="Conditional"
ID="UpdatePanel1">
<ContentTemplate>
<asp:Button ID="Clipboard" runat="server" Text="Copy to Clipboard" />
</ContentTemplate>
<Triggers>
<atlas:ControlEventTrigger ControlID="UpdateTime" EventName="Click" />
</Triggers>
</atlas:UpdatePanel>

</div>

Jul 15 '07 #4
On Jul 15, 4:28 pm, Peter <pete...@circle-consulting.co.nzwrote:
I have a button on my ASP.NET 2.0 web page labelled "Copy to
Clipboard" which must use server side code to format some data in a
specific manner and then copy it to the client clipboard so it can be
pasted into another application. Initially I planned to have the
server-side code put the data string into a cookie and then use a
client-side Javascript function referenced in the button's
OnClientClick attribute to copy the contents of the cookie to the
client clipboard. However, to my display I've just figured out that
client-side code is always executed before server events.
Can someone give me an idea of how I can achieve what I need to be
able to do. Thanks.

Peter,
what sort of formatting you need ?? is it not possible using java
script to do that in client?? hope that make problem simpler

nahid
http://nahidulkibria.blogspot.com/
http://www.kaz.com.bd

Jul 15 '07 #5

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

Similar topics

5
by: Don Vaillancourt | last post by:
Hello all, Over the years as I design more database schemas the more I come up with patterns in database design. The more patterns I recognize the more I want to try to design some kind of...
9
by: sk | last post by:
I have an applicaton in which I collect data for different parameters for a set of devices. The data are entered into a single table, each set of name, value pairs time-stamped and associated with...
2
by: Test User | last post by:
Hi all, (please excuse the crosspost as I'm trying to reach as many people as possible) I am somewhat familiar with Access 2000, but my latest project has me stumped. So, I defer to you...
6
by: rodchar | last post by:
Hey all, I'm trying to understand Master/Detail concepts in VB.NET. If I do a data adapter fill for both customer and orders from Northwind where should that dataset live? What client is...
17
by: tshad | last post by:
Many (if not most) have said that code-behind is best if working in teams - which does seem logical. How do you deal with the flow of the work? I have someone who is good at designing, but...
17
by: roN | last post by:
Hi, I'm creating a Website with divs and i do have some troubles, to make it looking the same way in Firefox and IE (tested with IE7). I checked it with the e3c validator and it says: " This...
6
by: JoeC | last post by:
I have a question about designing objects and programming. What is the best way to design objects? Create objects debug them and later if you need some new features just use inhereitance. Often...
0
by: | last post by:
I have a question about spawning and displaying subordinate list controls within a list control. I'm also interested in feedback about the design of my search application. Lots of code is at the...
19
by: neelsmail | last post by:
Hi, I have been working on C++ for some time now, and I think I have a flair for design (which just might be only my imagination over- stretched.. :) ). So, I tried to find a design...
8
by: indrawati.yahya | last post by:
In a recent job interview, the interviewer asked me how I'd design classes for the following problem: let's consider a hypothetical firewall, which filters network packets by either IP address,...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...
0
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...
0
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,...

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.