Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Making grid view columns invisible
Message
 
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01346211
Message ID:
01346305
Views:
8
I have this code in one of my pages that works fine.
 protected void ddlApprovedStatus_SelectedIndexChanged(object sender, EventArgs e)
    {
        DropDownList ddl = (DropDownList) sender; 

        if (ddl.SelectedIndex == 1 ) // Approved 
        {
         //   this.ProfilesGrid.Columns[0].Visible = false;
            this.ProfilesGrid.Columns[1].Visible = false;
            this.ProfilesGrid.Columns[4].Visible = true;            
        }
        else
        {
         //   this.ProfilesGrid.Columns[0].Visible = true;
            this.ProfilesGrid.Columns[1].Visible = true;
            this.ProfilesGrid.Columns[4].Visible = false;
            
        }
>Dear all:
>
>Using Visual Web Developer I bound my query result to a grid view and activate the multi view page the grid view is on with the following code:
>
>                GrdView.DataSource = myRead;
>                GrdView.DataBind();
>                MultiView1.ActiveViewIndex = 10;
>
>But there are some columns of my query result that I do not want to show in the grid view but which their values are of important later for selection of records in the grid view.
>
>What can I do for the columns that I do not want to show in the grid not to show and retrieve their values when selecting there selected records for the grid view?
>
>
>I tried the following:
>
>1)
>
GrdView.Columns[3].Visible = false;
>but this did not make the column invisible.
>
>2)
>
>for (int i = 0; i < GrdView.Rows.Count; i++)
>        GrdView.Rows[i].Cells[3].Visible = false;
>
>But this will move all the values of the columns following column 3 to the one column before them and the column header won’t change and also the last column has no value but the header that stayed.
>
>Thank you for your help in advance.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform