Amit
Amit

Reputation: 3478

grid view data in text box instead of cell

I have a web page containing a grid view and need to display the data in the text box on page load instead of cell.

** Grid is read only ** There will not be edit/delete links. is it possible ?

Thanks in advance.

Upvotes: 0

Views: 383

Answers (2)

huMpty duMpty
huMpty duMpty

Reputation: 14460

You can use gridview templates fields, and you will find more about Using TemplateFields in the GridView Control
You can do something like this

 <asp:TemplateField>
       <ItemTemplate>
            <asp:TextBox ID="txbType" Text='<%# Eval("fieldName") %>' Enabled="false" runat="server"></asp:TextBox>
       </ItemTemplate>
    </asp:TemplateField> 

In here <%# Eval("fieldName") %> -- fieldName should be the value need to be display from your DB

Upvotes: 1

KV Prajapati
KV Prajapati

Reputation: 94645

You have to add TemplateFields to the GridView and bind the TextBoxe(s) into ItemTemplate of each TemplateField column.

Upvotes: 0

Related Questions