how to bind typed data set to gridview and only view info you need?http://forums.asp.net/t/1800372.aspx/1?how+to+bind+typed+data+set+to+gridview+and+only+view+info+you+need+Tue, 08 May 2012 06:56:10 -040018003724966705http://forums.asp.net/p/1800372/4966705.aspx/1?how+to+bind+typed+data+set+to+gridview+and+only+view+info+you+need+how to bind typed data set to gridview and only view info you need? <p>im studying asp.net and is now using 3tier architecture<br> i have this code that gets the list of employees and binds it to gridview</p> <p>EmployeesBLL employeesLogic = new EmployeesBLL();<br> employeesGridView.DataSource = employeesLogic.GetEmployees();<br> employeesGridView.DataBind();</p> <p>i dont want to edit my gridview object to specify the columns to be displayed<br> so i leave it as it is &nbsp;&lt;asp:GridView ID=&quot;employeesGridView&quot; runat=&quot;server&quot;&gt;<br> &nbsp;&nbsp;&nbsp; &lt;/asp:GridView&gt;</p> <p>is it possible that upon binding the gridview only displays the names of employees not other info on my dataset?</p> <p></p> 2012-05-05T08:03:34-04:004966722http://forums.asp.net/p/1800372/4966722.aspx/1?Re+how+to+bind+typed+data+set+to+gridview+and+only+view+info+you+need+Re: how to bind typed data set to gridview and only view info you need? <p>or maybe i should not use gridview<br> <br> maybe a foreach loop with a Literal inside would be much better;</p> <p></p> 2012-05-05T08:17:04-04:004966851http://forums.asp.net/p/1800372/4966851.aspx/1?Re+how+to+bind+typed+data+set+to+gridview+and+only+view+info+you+need+Re: how to bind typed data set to gridview and only view info you need? <p>You may set AutoGenerateColumns propety of the GridView to False and add one BoundField with its datafiled as your&quot; Namefield&quot;</p> <pre class="prettyprint">&lt;asp:GridView ID=&quot;GridView1&quot; runat=&quot;server&quot; AutoGenerateColumns=&quot;False&quot;&gt; &lt;Columns&gt; &lt;asp:BoundField DataField=&quot;NameField&quot; HeaderText=&quot;Name&quot; SortExpression=&quot;NameField&quot; /&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt;</pre> <p></p> 2012-05-05T09:55:36-04:004967364http://forums.asp.net/p/1800372/4967364.aspx/1?Re+how+to+bind+typed+data+set+to+gridview+and+only+view+info+you+need+Re: how to bind typed data set to gridview and only view info you need? <p>yeah.. i know that.. but as ive said. i want to leave it as it is.. and instead code it on the .cs file<br> is there a way to do it?</p> 2012-05-06T02:28:55-04:004967444http://forums.asp.net/p/1800372/4967444.aspx/1?Re+how+to+bind+typed+data+set+to+gridview+and+only+view+info+you+need+Re: how to bind typed data set to gridview and only view info you need? <p>If so In&nbsp; RowDataBound event you can set the Visible property of unwanted cells to false. see the sample.</p> <pre class="prettyprint">protected void GridView1_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { e.Row.Cells[1].Visible = false; }</pre> <p></p> <p>&nbsp;</p> <p>&nbsp;</p> 2012-05-06T07:02:16-04:004969828http://forums.asp.net/p/1800372/4969828.aspx/1?Re+how+to+bind+typed+data+set+to+gridview+and+only+view+info+you+need+Re: how to bind typed data set to gridview and only view info you need? <p>sweet.. thank you very much</p> <p></p> 2012-05-08T00:40:33-04:004969832http://forums.asp.net/p/1800372/4969832.aspx/1?Re+how+to+bind+typed+data+set+to+gridview+and+only+view+info+you+need+Re: how to bind typed data set to gridview and only view info you need? <p>&nbsp;</p> <p>You are welcome..</p> <p>What about&nbsp; marking&nbsp; the&nbsp;answer that helped you as<em> ANSWER</em>?</p> 2012-05-08T01:05:28-04:004970220http://forums.asp.net/p/1800372/4970220.aspx/1?Re+how+to+bind+typed+data+set+to+gridview+and+only+view+info+you+need+Re: how to bind typed data set to gridview and only view info you need? <p>sorry thought i already marked it</p> <p>thanks again</p> 2012-05-08T06:56:10-04:00