Prev: Health monitoring and the event log
Next: sitemap
From: DavidC on 27 May 2010 16:56 I have a GridView that I want to hide a whole column based on a condition known before it is Databound. Is the best place to do this in RowDatabound or in PreRender or ??? Thanks. -- David
From: Mark Rae [MVP] on 28 May 2010 07:06 "DavidC" <dlchase(a)lifetimeinc.com> wrote in message news:8C22435D-F472-487B-9433-747C34212E11(a)microsoft.com... > I have a GridView that I want to hide a whole column based on a condition > known before it is Databound. Is the best place to do this in > RowDatabound > or in PreRender or ??? Thanks. I wouldn't do either... Presumably you have a server-side method which does the databinding and which you call as and when required e.g. protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) { BindData(); } } private void BindData() { DataSet MyDS = <fetch a DataSet from the DAL/BOL>; MyGridView.DataSource = MyDS; MyGridView.DataBind(); MyGridView.Columns[3].Visible = false; // hide the column } -- Mark Rae ASP.NET MVP http://www.markrae.net
|
Pages: 1 Prev: Health monitoring and the event log Next: sitemap |