Hi,
I am using radgrid for my application. In my application, I have changed the column position by drag-drop in runtime.
After refreshing the page or radgrid, the column was changed to its old position.
How to maintain its state?.
Please give any suggestions.
Thanks in advance.
Regards
Mahali
I am using radgrid for my application. In my application, I have changed the column position by drag-drop in runtime.
After refreshing the page or radgrid, the column was changed to its old position.
How to maintain its state?.
Please give any suggestions.
Thanks in advance.
Regards
Mahali
3 Answers, 1 is accepted
0
Hi Mahali,
How to maintain the order of the columns of your RadGrid across postbacks you can learn from the following forum thread which elaborates on this matter:
Maintain Column Order On Postback
Kind regards,
Pavlina
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
How to maintain the order of the columns of your RadGrid across postbacks you can learn from the following forum thread which elaborates on this matter:
Maintain Column Order On Postback
Kind regards,
Pavlina
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
S
Top achievements
Rank 1
answered on 15 Nov 2014, 11:29 AM
Hi,
i have an issue with maintaining state of template column textbox on paging in radgrid.
I am storing the data in session and then on need datasource event trying to get the data again from session.
But this does not help.
Please help me its urgent issue.please refer code below-
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<telerik:RadGrid ID="grChecklist1" runat="server" AutoGenerateColumns="false"
onneeddatasource="grChecklist1_NeedDataSource"
onpageindexchanged="grChecklist1_PageIndexChanged" >
<MasterTableView AllowPaging="true" AutoGenerateColumns="false" PageSize="5">
<Columns>
<telerik:GridTemplateColumn DataField="Number" HeaderText="Number" Visible="true">
<ItemTemplate>
<asp:TextBox ID="txtNumber" runat="server" Text='<%#Bind("Number")%>'/>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn DataField="TaskDescription" HeaderText="TaskDescription" Visible="true">
<ItemTemplate>
<asp:TextBox ID="txtTaskDescription" runat="server" Text='<%#Bind("TaskDescription")%>' />
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
LoadDetails();
}
}
private void LoadDetails()
{
DataTable dt = new DataTable();
dt.Columns.Add("Number",typeof(string));
dt.Columns.Add("TaskDescription", typeof(string));
dt.Rows.Add("1", "task1");
dt.Rows.Add("2", "task2");
dt.Rows.Add("3", "task3");
dt.Rows.Add("4", "task4");
dt.Rows.Add("5", "task5");
dt.Rows.Add("6", "task6");
dt.Rows.Add("7", "task7");
//grChecklist.DataSource = dt;
// grChecklist.DataBind();
Session["dt"] = dt;
}
private void RefreshSessionState()
{
DataTable dt = new DataTable();
dt.Columns.Add("Number", typeof(string));
dt.Columns.Add("TaskDescription", typeof(string));
foreach (GridDataItem item in grChecklist1.Items)
{
string number=(item.FindControl("txtNumber") as TextBox).Text;
string task = (item.FindControl("txtTaskDescription") as TextBox).Text;
dt.Rows.Add(number,task);
}
if (Session["dt"] != null)
Session.Remove("dt");
Session["dt"] = dt;
}
protected void grChecklist1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
// RefreshSessionState();
grChecklist1.DataSource = (DataTable)Session["dt"];
}
protected void grChecklist1_PageIndexChanged(object sender, GridPageChangedEventArgs e)
{
grChecklist1.AllowPaging = false;
grChecklist1.Rebind();
// RefreshSessionState();
grChecklist1.CurrentPageIndex = e.NewPageIndex;
grChecklist1.AllowPaging = true;
grChecklist1.Rebind();
}
}
i have an issue with maintaining state of template column textbox on paging in radgrid.
I am storing the data in session and then on need datasource event trying to get the data again from session.
But this does not help.
Please help me its urgent issue.please refer code below-
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<telerik:RadGrid ID="grChecklist1" runat="server" AutoGenerateColumns="false"
onneeddatasource="grChecklist1_NeedDataSource"
onpageindexchanged="grChecklist1_PageIndexChanged" >
<MasterTableView AllowPaging="true" AutoGenerateColumns="false" PageSize="5">
<Columns>
<telerik:GridTemplateColumn DataField="Number" HeaderText="Number" Visible="true">
<ItemTemplate>
<asp:TextBox ID="txtNumber" runat="server" Text='<%#Bind("Number")%>'/>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn DataField="TaskDescription" HeaderText="TaskDescription" Visible="true">
<ItemTemplate>
<asp:TextBox ID="txtTaskDescription" runat="server" Text='<%#Bind("TaskDescription")%>' />
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
LoadDetails();
}
}
private void LoadDetails()
{
DataTable dt = new DataTable();
dt.Columns.Add("Number",typeof(string));
dt.Columns.Add("TaskDescription", typeof(string));
dt.Rows.Add("1", "task1");
dt.Rows.Add("2", "task2");
dt.Rows.Add("3", "task3");
dt.Rows.Add("4", "task4");
dt.Rows.Add("5", "task5");
dt.Rows.Add("6", "task6");
dt.Rows.Add("7", "task7");
//grChecklist.DataSource = dt;
// grChecklist.DataBind();
Session["dt"] = dt;
}
private void RefreshSessionState()
{
DataTable dt = new DataTable();
dt.Columns.Add("Number", typeof(string));
dt.Columns.Add("TaskDescription", typeof(string));
foreach (GridDataItem item in grChecklist1.Items)
{
string number=(item.FindControl("txtNumber") as TextBox).Text;
string task = (item.FindControl("txtTaskDescription") as TextBox).Text;
dt.Rows.Add(number,task);
}
if (Session["dt"] != null)
Session.Remove("dt");
Session["dt"] = dt;
}
protected void grChecklist1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
// RefreshSessionState();
grChecklist1.DataSource = (DataTable)Session["dt"];
}
protected void grChecklist1_PageIndexChanged(object sender, GridPageChangedEventArgs e)
{
grChecklist1.AllowPaging = false;
grChecklist1.Rebind();
// RefreshSessionState();
grChecklist1.CurrentPageIndex = e.NewPageIndex;
grChecklist1.AllowPaging = true;
grChecklist1.Rebind();
}
}
0
Hello,
The answer of this question is available here:
http://www.telerik.com/forums/radgrid-template-column-maintain-state-on-paging
Regards,
Pavlina
Telerik
The answer of this question is available here:
http://www.telerik.com/forums/radgrid-template-column-maintain-state-on-paging
Regards,
Pavlina
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.