Search code examples
asp.netgridviewdevexpressdynamicradiobuttonlist

ASP.NET: Changing Gridview Properties Dynamically in Devexpress


I have a Gridview and RadioButtonList like this;

enter image description here

As you can see my Gridview can Enable for Editing, and some columns are DropdownList when editing. (also when it was bound)

enter image description here

I have 2 radiobutton in my RadioButtonList. Görüntüleme (It means View) and Düzenleme (It means Edit).

What I want is, If Düzenleme selected, normal Gridview can bind. (I can do that.) If Görüntüleme selected, Gridview can't has EnableEdit and I want all columns should be normal column. (GridViewDataTextColumn) So, people can only view the gridview.

The point is,

How can I change Gridview's EnalbleEdit and all column changed to GridViewDataTextColumn?


Solution

  • I found the solution.

    For ASP.NET Gridview

    Just change

    GridView1.AutoGenerateEditButton = False

    For Devexpress ASPxGridview

    Just change

    (ASPxGridView.Columns["#"] as GridViewCommandColumn).EditButton.Visible = false