添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
打篮球的拐杖  ·  在Spring ...·  1 年前    · 
安静的吐司  ·  Spring ...·  2 年前    · 
千杯不醉的绿茶  ·  CMakeSettings.json ...·  3 年前    · 
Ok, I am using the radgrid to databind to a DataTable and it isn't updating any of the data when the edit form update button is pressed. From what I understand I need to rebind the data when the update button is pressed, however when I do that I am left with an empty grid.
Page load code:
 if (!IsPostBack)
   {
       
       DataTable dt = new DataTable();
       dt.Columns.Add("User");
       dt.Columns.Add("Comment");
       DataRow dr = dt.NewRow();
       dr["User"] = "Name";
       dr["Comment"] = "This is a comment";
       dt.Rows.Add(dr);
       Session.Add("dt", dt);
       RadGridComments.DataSource = dt;
       RadGridComments.DataBind();
   
   }
RadGrid:
<telerik:RadGrid ID="RadGridComments" runat="server" AllowFilteringByColumn="True" 
        AllowPaging="True" GridLines="None" EnableAjax="true" 
        AllowAutomaticUpdates="True" 
        oneditcommand="RadGridComments_EditCommand" 
        AutoGenerateEditColumn="True" >
        <MasterTableView AllowAutomaticUpdates="True">
        </MasterTableView>
</telerik:RadGrid>
and the edit command:
 protected void RadGridComments_EditCommand(object sender, GridCommandEventArgs e)
  {
      RadGridComments.DataSource = (DataTable)Session["dt"];
      RadGridComments.Rebind();
  }
now I want to specify that I am not able to use a SQL database with this project and I am having some problems making my datasource persistent.  I am going to be loading content from a website and filling out the radgrid, then when the edit command fires I need to push the info to the website(and then pull and rebind I assume).  I am unable to get my simple test code here working and I would appreciate your help.  So how do I set the new info from the edit form to my datatable? when using SQL databases it felt like this was done for me.
Hello Jared,
Note that simple data-binding through the DataBind() method can be used in simple scenarios which does not require complex operations like insert/delete/update, grouping, hierarchy relations, etc.
Please try reworking the code to use only Advanced databinding vs Simple databinding and let me know how it goes.
All the best,
Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX . See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal .
Hi Jared,
To resolve this problem you should remove any DataBind() calls and configure the binding of your grid merely by means of NeedDataSource event handling.
More information on this subject can be found below:
http://demos.telerik.com/ASPNET/Prometheus/Grid/Examples/Programming/NeedDataSource/DefaultCS.aspx
http://www.telerik.com/help/aspnet-ajax/grdadvanceddatabinding.html
Greetings,
Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX . See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal .