Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
130 views
Hey,

Dynamically adding GridEditCommandColumns to my Grid in attempt to be able to edit chosen lines in a grid. The code to add them is below.
If ViewState("MasterEdit") Is Nothing Or Not ViewState("MasterEdit") = True Then
    Dim editCol As GridEditCommandColumn
    editCol = New GridEditCommandColumn
    editCol.UniqueName = "MasterEditColumn"
    editCol.HeaderText = ""
    editCol.HeaderStyle.Width = 20
    editCol.ButtonType = GridButtonColumnType.ImageButton
    editCol.EditImageUrl = "~\img\edit.gif"
    editCol.EditFormColumnIndex = 0
    rgdTable.MasterTableView.Columns.Add(editCol)
    ViewState.Add("MasterEdit", True)
End If

I do the same thing for the DetailTables. The problem I get is on the DetailTables the column just disappears entirely and on the MasterTable I get the following error:

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An error has occurred because a control with id 'ctl00$CPH1$ValueAddInfo$rgdTable$ctl00$ctl04$EditButton' could not be located or a different control is assigned to the same ID after postback. If the ID is not assigned, explicitly set the ID property of controls that raise postback events to avoid this error.

There doesn't seem to be any way to set the ID of the controls, so I can't take the advice that the error message suggests.
Antonio Stoilkov
Telerik team
 answered on 08 Dec 2011
3 answers
132 views
I have following problem with the RADGRID, when I put an ImageButton to delete I get error, that can not be because with
 a LinkButton working properly. I leave the code so that I can help.


thank you very much.

Codigo HTML:
  <telerik:RadGrid ID="GvwMacroprocesos" runat="server" AllowFilteringByColumn="True"
                                    AllowPaging="True" AutoGenerateColumns="False" GridLines="None" Skin="Hay" Width="809px"
                                    OnDeleteCommand="GvwMacroprocesos_DeleteCommand" OnItemCommand="GvwMacroprocesos_ItemCommand"
                                    OnItemDeleted="RadGrid1_ItemDeleted">
                                    <MasterTableView>
                                        <CommandItemSettings ExportToPdfText="Export to Pdf" />
                                        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                                        </RowIndicatorColumn>
                                        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                                        </ExpandCollapseColumn>
                                        <Columns>
                                            <telerik:GridButtonColumn CommandName="Editar" Text="Editar" UniqueName="Editar">
                                            </telerik:GridButtonColumn>
                                            <telerik:GridBoundColumn DataField="NombreMacroproceso" HeaderText="Macroproceso"
                                                UniqueName="column2">
                                                <HeaderStyle Font-Names="Verdana" Font-Size="10pt" HorizontalAlign="Center" Width="647px" />
                                                <ItemStyle Font-Names="Verdana" Font-Size="10pt" />
                                            </telerik:GridBoundColumn>
                                            <telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
                                                ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                                                ImageUrl="~/App_Themes/Skin/ImgBotones/Elminar.jpg" UniqueName="DeleteColumn">
                                                <ItemStyle HorizontalAlign="Center" />
                                            </telerik:GridButtonColumn>
                                        </Columns>
                                        <EditFormSettings>
                                            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                            </EditColumn>
                                        </EditFormSettings>
                                    </MasterTableView>
                                    <PagerStyle Mode="NextPrev" />
                                    <ClientSettings>
                                        <Selecting AllowRowSelect="True" />
                                    </ClientSettings>
                                    <FilterMenu EnableImageSprites="False">
                                    </FilterMenu>
                                    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Hay">
                                    </HeaderContextMenu>
                                </telerik:RadGrid>


Codigo aspx:
 protected void RadGrid1_ItemDeleted(object source, GridDeletedEventArgs e)
    {
        GridDataItem dataItem = (GridDataItem)e.Item;
        String id = dataItem.GetDataKeyValue("CodigoMacroproceso").ToString();
         object[] opParametros = new Object[3];
        if (e.Exception != null)
        {
                opParametros[0] = (int)dataItem .GetDataKeyValue("CodigoCliente");
                opParametros[1] = (int)dataitem.GetDataKeyValue("CodigoCompania");
                opParametros[2] = (int)dataitem.GetDataKeyValue("CodigoMacroproceso");
              
                    _fwAccesoDatos.ExecuteNonQuery(StrCadenaConexion, "spEliminarMacroproceso", opParametros);
        }
        else
        {
            ///
        }
    }






Error
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Invalid postback
 or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> 
in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this 
feature verifies that arguments to postback or callback events originate from the server control that 
originally rendered them.  If the data is valid and expected, use the ClientScriptManager.
RegisterForEventValidation method in order to register the postback or callback data for validation.


Iana Tsolova
Telerik team
 answered on 08 Dec 2011
2 answers
105 views
I have created a web page using a Telerik Grid bound to a SqlDataSource to allow users to page through some data.  Everything works correctly on my local machine, but when I publish it to the production server, it shows the first page of data but nothing else.  Clicking on the navigation links only brings back the first page as does attempting to filter or sort the data.  What could be causing this?

Grid Code:


<form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js"></asp:ScriptReference>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js"></asp:ScriptReference>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js"></asp:ScriptReference>
        </Scripts>
    </telerik:RadScriptManager>
    <telerik:RadGrid ID="CustomerInfoGrid" runat="server"
        AutoGenerateColumns="False" CellSpacing="0" DataSourceID="CRMData"
        GridLines="None" AllowPaging="True" PageSize="20"
        AllowFilteringByColumn="True"
        AllowSorting="True">
        <MasterTableView DataKeyNames="CustomerID" DataSourceID="CRMData">
            <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
            <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
         
            <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
 
            <Columns>
                <telerik:GridTemplateColumn UniqueName="GenerateSupportCode" AllowFiltering="False" Groupable="False" HeaderText="Support Code"
                    Reorderable="False" ShowSortIcon="False"></telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="CustomerID" DataType="System.Int32" FilterControlAltText="Filter CustomerID column" HeaderText="Customer ID"
                    ReadOnly="True" SortExpression="CustomerID" UniqueName="CustomerID"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="CustomerName" FilterControlAltText="Filter CustomerName column" HeaderText="Customer Name"
                    SortExpression="CustomerName" UniqueName="CustomerName"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="FingerprintData"
                    FilterControlAltText="Filter CustomerName column" Display="False"
                    SortExpression="FingerprintData" UniqueName="FingerprintData"></telerik:GridBoundColumn>
                <telerik:GridTemplateColumn UniqueName="ClearFingerprintDataColumn"
                    AllowFiltering="False" Groupable="False" HeaderText="Fingerprint Data"
                    Reorderable="False" SortExpression="FingerprintData"></telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="LicenseData"
                    FilterControlAltText="Filter CustomerName column" Display="False"
                    SortExpression="LicenseData" UniqueName="LicenseData"></telerik:GridBoundColumn>
                <telerik:GridTemplateColumn UniqueName="ClearLicenseDataColumn"
                    AllowFiltering="False" Groupable="False" HeaderText="License Data"
                    Reorderable="False" SortExpression="LicenseData"></telerik:GridTemplateColumn>
            </Columns>
         
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
            </EditFormSettings>
        </MasterTableView>
     
        <PagerStyle Position="TopAndBottom" />
     
        <FilterMenu EnableImageSprites="False">
            <WebServiceSettings>
                <ODataSettings InitialContainerName=""></ODataSettings>
            </WebServiceSettings>
        </FilterMenu>
 
        <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
            <WebServiceSettings>
                <ODataSettings InitialContainerName=""></ODataSettings>
            </WebServiceSettings>
        </HeaderContextMenu>
    </telerik:RadGrid>
 
    <asp:SqlDataSource ID="CRMData" runat="server"
        ConnectionString="<%$ ConnectionStrings:CRMConnectionString %>"
        SelectCommand="SELECT [CustomerName], [CustomerID], [LicenseData], [FingerprintData] FROM [Customers] WHERE ([Deleted] = @Deleted) ORDER BY [CustomerName]">
        <SelectParameters>
            <asp:Parameter DefaultValue="0" Name="Deleted" Type="Byte" />
        </SelectParameters>
    </asp:SqlDataSource>
</form>

Codebehind:

protected void CustomerInfoGrid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        Button btn = null;
        GridDataItem dataItem = e.Item as GridDataItem;
 
        btn = new Button();
        btn.OnClientClick = String.Format("return GetSupportCode({0})", dataItem["CustomerID"].Text);
        btn.Text = "Generate";
        dataItem["GenerateSupportCode"].Controls.Add(btn);
 
        dataItem["FingerprintData"].Text = dataItem["FingerprintData"].Text.Replace(" ", "");
        if (!String.IsNullOrEmpty(dataItem["FingerprintData"].Text.Trim()))
        {
            btn = new Button();
            btn.OnClientClick = String.Format("return ClearFingerprintData({0})", dataItem["CustomerID"].Text);
            btn.Text = "Clear";
            dataItem["ClearFingerprintDataColumn"].Controls.Add(btn);
        }
 
        dataItem["LicenseData"].Text = dataItem["LicenseData"].Text.Replace(" ", "");
        if (!String.IsNullOrEmpty(dataItem["LicenseData"].Text.Trim()))
        {
            btn = new Button();
            btn.OnClientClick = String.Format("return ClearLicenseData({0})", dataItem["CustomerID"].Text);
            btn.Text = "Clear";
            dataItem["ClearLicenseDataColumn"].Controls.Add(btn);
        }
 
    }
}

Iana Tsolova
Telerik team
 answered on 08 Dec 2011
1 answer
282 views
Hi, i have a chart which normally has a x axis with a date value.
Under certain circumstances, I'd like to group the results and show the monthly accumulated values, and show the month name

In the data I have both a date field and a month field, and I can easily group by the month field, but I can't seem to format it so that it show the month name rather than the month value.

Can you please point me in the right direction?

This is what I have so far:
Private Sub chart1_ItemDataBinding(ByVal sender As Object, ByVal e As EventArgs) Handles Chart1.ItemDataBinding
 
    Chart1.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = -90
 
    If Me.ReportParameters("Time").Value.ToString.Trim = "Daily" Then
        Chart1.PlotArea.XAxis.DataLabelsColumn = "userlogdate"
    ElseIf Me.ReportParameters("Time").Value.ToString.Trim = "Yearly" Then
        Chart1.PlotArea.XAxis.DataLabelsColumn = "year"
        Chart1.DataGroupColumn = "year"
    ElseIf Me.ReportParameters("Time").Value.ToString.Trim = "Monthly" Then
        Chart1.DataGroupColumn = "month"
        Chart1.PlotArea.XAxis.DataLabelsColumn = "month"
        Chart1.PlotArea.XAxis.Appearance.ValueFormat = Charting.Styles.ChartValueFormat.ShortDate
        Chart1.PlotArea.XAxis.Appearance.CustomFormat = ???
 
    End If
 
 
End Sub

Thanks for you help
Nikolay
Telerik team
 answered on 08 Dec 2011
2 answers
117 views
I am using datasource to bind the tree initially using DataBind() method. I am able to set Text, Image using RadTreeNodeBinding but not able to set custom attributes directly. Is there any way I can add the values to the node using datasource?
Bozhidar
Telerik team
 answered on 08 Dec 2011
1 answer
113 views
Hi,

I am using a Tabstrip with a multipage, navigating between pageviews by clicking the tabs.
On tab2 I placed a usercontrol containing a Radlistbox. This is rendered fine when I open the webpage with tab2 selected, it shows the 8 items inside.

But when I open the webpage with another tab selected, and then switch to tab2, the Radlistbox shows only 2 items. 
This only happens in IE9, other version and browsers work fine. I use Telerik version 2011.2.712.35.

Has anyone seen this before and knows how to solve it?

Annet


Bozhidar
Telerik team
 answered on 08 Dec 2011
4 answers
197 views
Hi,

I need to display limited characters only in grid.I followed the following thread and it is working.
http://www.telerik.com/community/forums/aspnet/grid/display-limited-characters-in-radgrid.aspx


Now for diffreent resolutions and monitors this hardcoded character limit is not going well.

So i want to get the column width and number of characters fit to that .I will give the column widths in %.

I want something like if (no:of characters in the column > column width)  then
column.text=truncate till it fits in that column+"..."

Also if there is any other way  to achieve this plz tell me...

Could any body please help me..
Thanks.
Winni
Top achievements
Rank 1
 answered on 08 Dec 2011
1 answer
139 views
i have one table like -receipt transaction one coloumn name is headtype within headtype i have like schoolfee duefee and hostelfee is there. i have to bind schoolfee,due fee,hostelfee in rad pi chart
Bartholomeo Rocca
Top achievements
Rank 1
 answered on 08 Dec 2011
1 answer
651 views
Hello,

Telerik ASP.NET Ajax: 2011.3.1115.40
Language. VB.NET

We try to know how to use the web.config settings "Telerik.Web.SkinsAssembly" with a custom skin created by Telerik Style Builder.

For this, we did the following steps:
  1. We created a custom skin by Telerik Style Builder named "MySkin" with all controls skinned.
  2. We transformed the skin "MySkin" into an assembly "MySkinAssembly" with namespace "MySkinNamespace" by the tool of Bryan Boudreau, Telerik-webresourcebuilder:
  3. We add in <appSettings> the lines:
<add key="Telerik.Web.SkinsAssembly" value="MySkinAssembly" />
<add key="Telerik.Skin" value="MySkin" />
<add key="Telerik.EnableEmbeddedSkins" value="false" />
  4. In a web page, we added a <telerik:RadButton id runat ... /> but without the tag Skin, because Telerik adds it with "MySkin" taken from "Telerik.Skin" setting.

The result was that the RadButton was not skinned.

But if we add "RadStylesheetManager" with an entry for the RadButton in the page, like:
<RadStylesheetManager ...>
  <
StyleSheets>
   
<StyleSheetReference Name="MySkinAssembly.MySkinNamespace.Button.MySkin.css" Assembly="MySkinAssembly" />
  </StyleSheets>
</RadStylesheetManager>

it works!

How can we use the web.config settings "Telerik.Web.SkinsAssembly" without "RadStylesheetManager"?

Thank you
Alain
Lini
Telerik team
 answered on 08 Dec 2011
8 answers
743 views
Hi All,

I am using RadTimePicker.

I want to set the time in RadTimepicker from javascript.
Please help me.

Thanks
Princy
Top achievements
Rank 2
 answered on 08 Dec 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?