Hi i have an asp.net application, i am using also visual basic with visual web developer 2005 express. I have a formview with one button and one textbox, i want to be able to click the button and copy the content of the textbox like Ctrl C to paste this data in other application. How can i modify the java script to work on my code?
here is my code:
<asp:FormView ID="FormView1" runat="server" CellPadding="4" DataSourceID="SqlDataSource1"
ForeColor="#333333" GridLines="Both" HeaderText="Copy">
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#999999" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<ItemTemplate>
<table style="width: 495px; height: 84px" border="1" bordercolor="gainsboro">
<tr>
<td style="width: 156px; text-align: left;">
<asp:Label ID="Label3" runat="server" Font-Bold="True" Font-Names="Arial" Font-Size="Small"
Text="Order ID:"></asp:Label></td>
<td style="width: 302px">
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("order_number", "{0}") %>'
Width="250px"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" /></td>
</tr>
that's the javascript i've found:
<script>
function ClipBoard(tdObj)
{
var holdtext = document.all['holdtext'];
holdtext.innerText = tdObj.innerText;
Copied = holdtext.createTextRange();
Copied.execCommand("Copy");
}
</script>
.
.
.
<td><img src=“copy.gif“ onclick=“ClipBoard(this.parentElement)“> TEXT TO COPY</td>
.
.
<textarea id=“holdtext“ style=“display:none“></textarea>