virtual protected void GenerateScriptToRedirectHomePage(string errorMessage, bool isRedirect)
{
StringBuilder RedirectPage = new StringBuilder("");
RedirectPage.Append(
"<script language=\"javascript\">\n window.onload = RedirectPage;\n function RedirectPage() {");
RedirectPage.Append(
"alert(\"" + errorMessage + "\");");
if (isRedirect)
{
RedirectPage.Append(
"location.href = \"" + _Referer + "\";");
}
RedirectPage.Append(
"} </script>");
Page.ClientScript.RegisterClientScriptBlock(GetPageType(),
"RedirectPage", RedirectPage.ToString());
}
When i use filter grid or grouping i have the problem in the subject.
I see also this post:
http://www.telerik.com/community/forums/aspnet-ajax/grid/unable-to-cast-object-of-type-telerik-web-ui-radgrid-to-type-telerik-web-ui-gridtableview.aspx
i add the httpHandlers but not work.
Thank Luca Martini
My error page is this:
| Errore server nell'applicazione '/REMONIO2008'. |
| -------------------------------------------------------------------------------- |
| Impossibile eseguire il cast di oggetti di tipo 'Telerik.Web.UI.RadGrid' sul tipo 'Telerik.Web.UI.GridTableView'. |
| Descrizione: Eccezione non gestita durante l'esecuzione della richiesta Web corrente. Per ulteriori informazioni sull'errore e sul suo punto di origine nel codice, vedere l'analisi dello stack. |
| Dettagli eccezione: System.InvalidCastException: Impossibile eseguire il cast di oggetti di tipo 'Telerik.Web.UI.RadGrid' sul tipo 'Telerik.Web.UI.GridTableView'. |
| Errore nel codice sorgente: |
| Durante l'esecuzione della richiesta Web corrente è stata generata un'eccezione non gestita. Per informazioni sull'origine e la posizione dell'eccezione, vedere l'analisi dello stack dell'eccezione riportata di seguito. |
| Analisi dello stack: |
| [InvalidCastException: Impossibile eseguire il cast di oggetti di tipo 'Telerik.Web.UI.RadGrid' sul tipo 'Telerik.Web.UI.GridTableView'.] |
| Telerik.Web.UI.RadGrid.RaisePostBackEvent(String eventArgument) +2771 |
| System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 |
| System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175 |
| System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565 |
| -------------------------------------------------------------------------------- |
| Informazioni di versione: Versione di Microsoft .NET Framework:2.0.50727.3082; Versione di ASP.NET:2.0.50727.3082 |
My asp code is this:
| <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> |
| <telerik:RadGrid id="RadGrid1" runat="server" AllowFilteringByColumn="True" |
| AllowPaging="True" AllowSorting="True" GridLines="None" ShowGroupPanel="True" > |
| <MasterTableView AutoGenerateColumns="False"> |
| <Columns> |
| <telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="Unita Economiche"> |
| <ItemTemplate> |
| <asp:linkbutton id=LinkUe runat="server" CssClass="LinkElencoPortafogli" Text='<%# DataBinder.Eval(Container.DataItem, "IdUe") %>' CommandName='<%# DataBinder.Eval(Container.DataItem, "IdUe") %>' CommandArgument='<%# DataBinder.Eval(Container.DataItem, "TipologiaUe") %>' ToolTip="Premi per visualizzare i dati dell'Unità Economica"> |
| </asp:linkbutton> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridBoundColumn HeaderText="Denominazione" DataField="Denominazione" |
| UniqueName= "Denominazione"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn HeaderText="Regione" DataField="Regione" |
| UniqueName= "Regione"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn HeaderText="provincia" DataField="provincia" |
| UniqueName= "provincia"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn HeaderText="Comune" DataField="Comune" |
| UniqueName= "Comune"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn HeaderText="Indirizzo" DataField="Indirizzo" |
| UniqueName= "Indirizzo"></telerik:GridBoundColumn> |
| <telerik:GridTemplateColumn UniqueName="TemplateColumn1" HeaderText="Planimetria"> |
| <ItemStyle Width="110px" VerticalAlign="Top"></ItemStyle> |
| <ItemTemplate> |
| <asp:linkbutton id="linkGS" runat="server" CssClass="LinkElencoPortafogli" Text='planimetrie' CommandName='<%# DataBinder.Eval(Container.DataItem, "IdUe") %>' CommandArgument='<%# DataBinder.Eval(Container.DataItem, "TipologiaUe") %>' ToolTip="Premi per visualizzare i dati nella gestione spazi"> |
| </asp:linkbutton> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| </Columns> |
| </MasterTableView> |
| <ClientSettings AllowDragToGroup="True"> |
| <Scrolling AllowScroll="True" UseStaticHeaders="True" /> |
| </ClientSettings> |
| </telerik:RadGrid> |
My c# code is this:
| private void EstrazioneRicerca() |
| { |
| DataTable MiaDataTableRicerca = new DataTable(); |
| ConnessioneDb.Open(); |
| try |
| { |
| SqlCommand cmd = Funzioni.CreaSqlCommand("StpRicercaUe", ConnessioneDb, null); |
| cmd.Parameters.Add(new SqlParameter("@ClausolaWhere", SqlDbType.NVarChar, 1000)).Value = ClausolaWhere(); |
| SqlDataAdapter MioAdapterRicerca = new SqlDataAdapter(cmd); |
| MioAdapterRicerca.Fill(MiaDataTableRicerca); |
| } |
| finally |
| { |
| ConnessioneDb.Close(); |
| } |
| if(MiaDataTableRicerca.Rows.Count == 0) |
| { |
| Label24.Text = "Non sono state trovate Unità Economiche con i parametri di ricerca digitati."; |
| Label24.Visible = true; |
| Datagrid1.CurrentPageIndex = 0; |
| Table18.Visible = false; |
| Label2.Visible = false; |
| Datagrid1.Visible = false; |
| NextBackPager1.Visible = false; |
| PageNumbersPager1.Visible = false; |
| NextBackPager2.Visible = false; |
| } |
| else |
| { |
| Label24.Visible = false; |
| RadGrid1.DataSource = MiaDataTableRicerca; |
| RadGrid1.DataBind(); |
| } |
| } |
| <telerik:RadFileExplorer ID="RadFileExplorer1" Height="410px" Width="400px" TreePaneWidth="150px" |
| runat="Server" EnableOpenFile="false" AllowPaging="true"> |
| Protected Sub RadComboBox1_ItemsRequested(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs) Handles RadComboBox1.ItemsRequested |
| CustDropDownSQL.SelectCommand = "SELECT [CCUST], [CNME] FROM [RCM] WHERE [CMID] = 'CM' and [CNME] Like '" + e.Text + "%' ORDER BY [CNME] ASC" |
| RadComboBox1.DataSource = CustDropDownSQL |
| RadComboBox1.DataTextField = "CNME" |
| RadComboBox1.DataValueField = "CCUST" |
| RadComboBox1.DataBind() |
| End Sub |
Hi
i'm new with telerik controls i have some questions about the radGrid
1- i have bound the grid to a sqldatasourse and set the data source insert query set allowautomaticdelete, allowautomaticedit,allowautomaticinsert all to true
now i have edit and delete buttons where is the insert button it is not shown
2- i made a normal link button insted of the insert button and but onclick event for that button
RadGrid1.MasterTableView.InsertItem()
that show an insert form with text box for every column except the primary key it not shown of course the insert fails without the primary key
3- how can i customize the insert form (use checkbox and dropdown insted of textbox)
thanks for the help