Click here to Skip to main content
16,012,468 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my code below I have a gridview that shows in a popup window...when i seleect a row I want i want the first column to show up in textbox1 ..how do i do that?

XML
<asp:ModalPopupExtender ID="mpe" runat="server" BehaviorID="popup1" PopupControlID="pnlPopup" TargetControlID="btnloccode"
            OkControlID="btnOK" CancelControlID="btnCancel" BackgroundCssClass="modalBackground">
        </asp:ModalPopupExtender>
        <asp:Panel ID="pnlPopup" runat="server" CssClass="modalPopup" Style="display: none">
            <div class="header">
                List Selection
            </div>
                <br />
            <asp:UpdatePanel ID="UpdatePanel1" runat="server" align="left">
            <ContentTemplate>
        <asp:Panel runat="server" ID="pnl1" Style="max-height: 300px; overflow-y: scroll;">
    <asp:GridView ID="LocationGridView" HeaderStyle-BackColor="#0066CC" HeaderStyle-ForeColor="White"
        runat="server" AutoGenerateColumns="false" DataSourceID="SQLlistsel" OnDataBound="OnDataBound" Width="580">
        <Columns>
            <asp:BoundField DataField="LOCATIONID" HeaderText="Id" ItemStyle-Width="10">
            <ItemStyle Width="10px"/>
            </asp:BoundField>
            <asp:BoundField DataField="LOCNM" HeaderText="Name" ItemStyle-Width="100" >
            <ItemStyle Width="100px" />
            </asp:BoundField>
            <asp:BoundField DataField="STATUS" HeaderText="Status" ItemStyle-Width="100" >
            <ItemStyle Width="100px" />
            </asp:BoundField>
        </Columns>
        <HeaderStyle BackColor="#0066CC" ForeColor="White" />
    </asp:GridView>
    </asp:Panel>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <script src="Scripts/quicksearch.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $('.search_textbox').each(function (i) {
                $(this).quicksearch("[id*=LocationGridView] tr:not(:has(th))", {
                    'testQuery': function (query, txt, row) {
                        return $(row).children(":eq(" + i + ")").text().toLowerCase().indexOf(query[0].toLowerCase()) != -1;
                    }
                });
            });
        });
    </script>
Posted

1 solution

Use TemplateField instead of BoundField. See below example:

ASP.NET
<asp:templatefield headertext="Id" itemstyle-width="10><br mode=" hold=" />                        <ItemTemplate><br mode=" textbox1=" runat=" server=" <br mode=" locationid=") %>'></asp:TextBox><br mode=" center=" /><br mode=" xmlns:asp="#unknown"></asp:templatefield>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900