How to copy gridview cell values?
I have a gridview that displays item #'s and my users want to be able to highlight any number and copy it by either right clicking or ctrl + c. But for some reason the individual cells can't be highlighted by double clicking. And when dragging over text it highlights the entire table!
<asp:GridView BorderWidth=1px BorderColor=Black Borderstyle=Solid HeaderStyle-BackColor=Aquamarine runat=server style="z-index: 100; left: 9px; position: absolute; top: 106px" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" ID="GridView1" AllowPaging="True" AllowSorting="True"> <Columns> <asp:BoundField DataField="itemNumber" HeaderText="#" SortExpression="itemNumber" > <ItemStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" CssClass="Col" ForeColor="#0000C0" /> <HeaderStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" /> </asp:BoundField> <asp:BoundField DataField="FirstPayDate" HeaderText="First Pay Date" SortExpression="FirstPayDate" > <ItemStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" CssClass="Col" ForeColor="#0000C0" /> <HeaderStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" /> </asp:BoundField> <asp:BoundField DataField="Screen" HeaderText="Screen" SortExpression="Screen" > <ItemStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" CssClass="Col" ForeColor="#0000C0" /> <HeaderStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" /> </asp:BoundField> <asp:BoundField DataField="Problem" HeaderText="Problem" SortExpression="Problem" > <ItemStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" CssClass="Col" ForeColor="#0000C0" /> <HeaderStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" /> </asp:BoundField> <asp:BoundField DataField="DateIn" HeaderText="Date in" SortExpression="DateIn" > <ItemStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" CssClass="Col" ForeColor="#0000C0" /> <HeaderStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" /> </asp:BoundField> <asp:BoundField DataField="Code" HeaderText="Code" SortExpression="Code" > <ItemStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" CssClass="Col" ForeColor="#0000C0" /> <HeaderStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" /> </asp:BoundField> <asp:CommandField HeaderText="Action" SelectText="Fixed" ShowSelectButton="True"> <ItemStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" CssClass="Col"/> <HeaderStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="2px" /> </asp:CommandField> </Columns> <PagerTemplate> Goto Page <asp:DropDownList ID="ddlPageSelector" OnSelectedIndexChanged="pageChange" runat="server" AutoPostBack="true"> </asp:DropDownList> Total Errors: <asp:Label ID="lbl_Total" runat="server" Text="Label"></asp:Label> </PagerTemplate> <HeaderStyle BackColor="Aquamarine" /></asp:GridView>
Try using a TemplateField instead of the BoundField. Then use a span to display your info.
Labels: ado, cell, clicking, copy, ctrl, displays, gridview, highlight, item, net, number, users, values
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home