protected void Button1_Click(object sender, EventArgs e)
{
RadGrid1.DataSource = RunStoredProcSearch(
"SearchNameCity", SearchGrid.Text);
RadGrid1.DataBind();
}
public DataSet RunStoredProcSearch(string spName, string search)
{
SqlConnection conn = null;
SqlDataReader rdr = null;
try
{
// create and open a connection object
conn =
new
SqlConnection("Data Source=LDSERVER1\\SQLLD;Initial Catalog=AviarySQL;Integrated Security=True");
conn.Open();
// 1. create a command object identifying
// the stored procedure
SqlCommand cmd = new SqlCommand(
spName, conn);
// 2. set the command object so it knows
// to execute a stored procedure
cmd.CommandType =
CommandType.StoredProcedure;
// 3. add parameter to command, which
// will be passed to the stored procedure
cmd.Parameters.Add(
new SqlParameter("@pattern", search));
// execute the command
cmd.Connection.Open();
SqlDataReader reader = cmd.ExecuteReader();
return reader;
}
finally
{
if (conn != null)
{
conn.Close();
}
if (reader != null)
{
rdr.Close();
}
}
}
| 'Unable to cast object of type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection' to type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection'. |
| We had to modify the web configure file to not use .net framework 3.5 |
| Protected Sub dg_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles dg.ItemCommand |
| If e.CommandName = "editChild" Then |
| If Not e.Item.Expanded Then |
| e.Item.Expanded = True |
| End If |
| Dim item As GridDataItem = CType(e.Item, GridDataItem) |
| Dim nestedTableView As GridTableView = CType(item.ChildItem.NestedTableViews(0), GridTableView) |
| For Each grandChild As GridDataItem In nestedTableView.Items |
| grandChild.Edit = True |
| Next |
| nestedTableView.Rebind() |
| <telerik:RadScriptBlock runat="server"> |
| <script language="javascript" type="text/javascript"> |
| function Row_Select(arg) { |
| var mt = $find("<%# RadGrid1.ClientID %>").get_masterTableView(); |
| var row = mt.get_dataItems()[arg]; |
| mt.selectItem(row.get_element()); |
| } |
| function RowClick(sender, eventArgs) { |
| var mt = $find("<%# RadGrid1.ClientID %>").get_masterTableView(); |
| var row = mt.get_dataItems()[eventArgs.get_itemIndexHierarchical()]; |
| mt.selectItem(row.get_element()); |
| } |
| </script> |
| </telerik:RadScriptBlock > |