change GridViews ColumnStyles Programmatically in Codebehind
-
Hello I'm sure you saw this request fro several times, but please help me. i'm a Windows Application Developer (C#) and i always change properties of controls programmatically. i did these:
sqlDatasource1.Connectionstring = ... ; sqlDataSource1.SelectCommand = "SELECT idn, header, date FROM tblNews'; sqlDataSource1.DataBind(); gridView1.dataSourceID = sqlDataSource1; gridView1.DataBind();
Now i want to do these in CodeBehind: 1-Change columns HeaderText and width 1-Change column[1] (header) to HyperLink 2-Add Button with Text="Active', Identify when user clicks on it and it's RowId I know it takes time for helping me, Please take me usefull references in web. Tanx -
Hello I'm sure you saw this request fro several times, but please help me. i'm a Windows Application Developer (C#) and i always change properties of controls programmatically. i did these:
sqlDatasource1.Connectionstring = ... ; sqlDataSource1.SelectCommand = "SELECT idn, header, date FROM tblNews'; sqlDataSource1.DataBind(); gridView1.dataSourceID = sqlDataSource1; gridView1.DataBind();
Now i want to do these in CodeBehind: 1-Change columns HeaderText and width 1-Change column[1] (header) to HyperLink 2-Add Button with Text="Active', Identify when user clicks on it and it's RowId I know it takes time for helping me, Please take me usefull references in web. TanxHi, Instead of creating columns automattically at runtime. You can create the custom columns. Go to property builder of gridview and the uncheck the Automatically create columns at runtime. Add the desired columns there giving desired header name and datafield.
-
Hello I'm sure you saw this request fro several times, but please help me. i'm a Windows Application Developer (C#) and i always change properties of controls programmatically. i did these:
sqlDatasource1.Connectionstring = ... ; sqlDataSource1.SelectCommand = "SELECT idn, header, date FROM tblNews'; sqlDataSource1.DataBind(); gridView1.dataSourceID = sqlDataSource1; gridView1.DataBind();
Now i want to do these in CodeBehind: 1-Change columns HeaderText and width 1-Change column[1] (header) to HyperLink 2-Add Button with Text="Active', Identify when user clicks on it and it's RowId I know it takes time for helping me, Please take me usefull references in web. TanxHi Max, Check this link. It is given in detail how you can create columns dynamically. http://www.123aspx.com/redir.aspx?res=35975
rAm i Think, i Wait, i Fast -- Siddartha
-
Hi, Instead of creating columns automattically at runtime. You can create the custom columns. Go to property builder of gridview and the uncheck the Automatically create columns at runtime. Add the desired columns there giving desired header name and datafield.
Hello Friends How can i know which row user clicked on it? I saw in forums they use CommandClick with e.command argument, but i can't see this event for GridView in Properties box! I don't want to use Select Column of GridView. Tanx
-
Hello Friends How can i know which row user clicked on it? I saw in forums they use CommandClick with e.command argument, but i can't see this event for GridView in Properties box! I don't want to use Select Column of GridView. Tanx
Trap the CellMouseClick event... You can then use the e.RowIndex to know the row clicked by the user.:->