This is a migrated thread and some comments may be shown as answers.

[Solved] Change radgrid datasource and rebind

2 Answers 311 Views
Grid
This is a migrated thread and some comments may be shown as answers.
noyan
Top achievements
Rank 1
noyan asked on 01 Apr 2009, 11:37 AM
I got a button, when button clicked

 

protected void btnModify_Click(object sender, ImageClickEventArgs e)

 

{

RadGrid2.DataSource = GetDataTable(

"SELECT Users.Personelid, Users.name, Users.surname FROM Users WHERE");

 

RadGrid2.DataBind();

}

I do the above operation but Radgrid do not accept new datasource and change its columns acording to it. How can I assign a new datasource and bind it?All help will be appreciated. By the way I dont want to use need_datasource event, at first time gridview has to show nothing but after user make some operation and click the button it has to populate on demand and show the result of query

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 02 Apr 2009, 05:03 AM
Hi Noyan,

Have you set the AutoGenerateColumns property to true? If not try setting it to true and see whether the Grid is showing data.

ASPX:
 
 
<telerik:RadGrid ID="RadGrid2" AllowPaging="true"  AutoGenerateColumns="true" PageSize="5" AllowSorting="true" runat="server"
            </telerik:RadGrid> 

Shinu.
0
noyan
Top achievements
Rank 1
answered on 02 Apr 2009, 07:48 AM

I tried to do same thing by changing autogeneratedcolumn property in both situation it didnt work. Here is my gridview code,
 

<telerik:RadGrid ID="RadGrid2" runat="server" AutoGenerateColumns="False">  
<MasterTableView> 
<RowIndicatorColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
 
<ExpandCollapseColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</ExpandCollapseColumn> 
</MasterTableView> 
 
<FilterMenu EnableTheming="True">  
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
</FilterMenu> 
            </telerik:RadGrid> 

 


as you can see it has no needdatasource cos, I have to dynamically create it, when button click and datasource will be set as well. All help will be appreciated.

 

 

 

 

Tags
Grid
Asked by
noyan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
noyan
Top achievements
Rank 1
Share this question
or