Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
SqlCommand cmd = new SqlCommand("SLECT subCode,supName FROM SUPPLIER", sqlCon);
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
adapter.Fill(dSetTEMP.ITEM_SEARCH_COLTWO);
gvSearch.DataSource = dSetTEMP.ITEM_SEARCH_COLTWO;


above is my code

this dSetTemp Is a dataset and the ITEM_SEARCH_COLTWO is a data table

this code fill the grid view with rows with empty rows
if the sql select 10 record grid fill with 10 record

how to sort this issue
thanks
Posted
Updated 20-Nov-14 23:52pm
v2
Comments
Vinay Mistry 21-Nov-14 5:52am    
If you have added boundfield then check DataTextField property of the column

1 solution

Try..
C#
gvSearch.DataSource = dSetTEMP.ITEM_SEARCH_COLTWO;
gvSearch.DataBind();


And Set..
ShowHeaderWhenEmpty and EmptyDataText propery in gridview. like this
C#
<asp:gridview id="gvSearch" runat="server" allowpaging="false" autogeneratecolumns="False" emptydatatext="No Records Found" showheaderwhenempty="True" width="100%" xmlns:asp="#unknown">
</asp:gridview>
 
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