Garima Bansal

Garima Bansal

  • 1.8k
  • 388
  • 18.1k

show text instead of value in gridview

Mar 10 2023 10:52 AM

I have a gridview that gets the data from a database and it has SectorId, name,mobile 

But in Database table SectorId is save in Value and i want text in Gridview on pageload

<asp:GridView ID="grdtrack" runat="server" AutoGenerateColumns="false" AllowPaging="true" PageSize="10" Visible="false">
        <asp:BoundField HeaderText="Id" DataField="Id" Visible="false" />
        <asp:BoundField ItemStyle-Width="150px" DataField="Name" HeaderText="Name" />
        <asp:BoundField ItemStyle-Width="150px" DataField="Mobile_No" HeaderText="Mobile No" />
        <asp:BoundField ItemStyle-Width="150px" DataField="SectorId" HeaderText="Grievance Sector" />
        <asp:BoundField ItemStyle-Width="150px" DataField="Details" HeaderText="Remarks" />
        <asp:TemplateField HeaderText="Action">
                <asp:LinkButton ID="lnk_View" Text="View" CommandArgument='<% #Eval("Id") %>' runat="server" />



Answers (6)