Grid disappears while editing Radgrid

Posted by Oswaldlily under ASP.NET on 11/15/2014 | Points: 10 | Views : 542 | Status : [Member] | Replies : 1
In Radgrid telerik control ,When I click Edit button,my grid disappears..Why??




Responses

Posted by: A2H on: 11/19/2014 [Member] [MVP] Silver | Points: 25

Up
0
Down
Ensure that you have rebinding your GrdiView in the NeedDataSourceEvent of telerik RadGrid

<telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource"
AllowPaging="true" OnUpdateCommand="RadGrid1_UpdateCommand" OnInsertCommand="RadGrid1_InsertCommand"
OnDeleteCommand="RadGrid1_DeleteCommand" >
<MasterTableView AutoGenerateColumns="False" DataKeyNames="OrderID" CommandItemDisplay="Top">
<Columns>
<%--Your Columns here--%>
</Columns>
</MasterTableView>
</telerik:RadGrid>


C#:
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
SqlConnection conn = new SqlConnection("Provide your Connectionstring here");
DataTable dt1 = new DataTable();
//Put Your code to load the data
string strquery = "SELECT [OrderID], [CustomerID], [EmployeeID], [OrderDate], [ShipName] FROM [Orders]";
SqlDataAdapter adapter1 = new SqlDataAdapter(strquery, conn);
conn.Open();
adapter1.Fill(dt1);
conn.Close();
RadGrid1.DataSource = dt1;
}


Thanks,
A2H
My Blog

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response