Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
816 views
Hi,

I am using Rad-grid hierarchical. when i am trying to rebind the grid after update or insert. i am getting "FixedId" is neither a DataColumn nor a data Relation"  Here i added my design and code behind please let me know where i am going wrong.
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" Skin="Black" OnItemDataBound="RadGrid1_ItemDataBound" OnItemCreated="RadGrid1_ItemCreated"
    AllowSorting="True" AllowMultiRowSelection="False" OnItemCommand="RadGrid1_ItemCommand" AutoGenerateEditColumn="false"
    OnDetailTableDataBind="RadGrid1_DetailTableDataBind" OnNeedDataSource="RadGrid1_NeedDataSource" OnInsertCommand="RadGrid1_InsertCommand" OnDataBound="RadGrid1_DataBound"
    OnPreRender="RadGrid1_PreRender" >
 
    <MasterTableView DataKeyNames="TempAccountsId" ShowFooter="true" TableLayout="Fixed" AllowMultiColumnSorting="True" EditMode="InPlace" >
        <DetailTables>
            <telerik:GridTableView DataKeyNames="FixedId" CommandItemDisplay="Top"  TableLayout="Fixed" Name="Fixed" ShowFooter="true" EditMode="InPlace" AllowAutomaticUpdates="false">
                <Columns>
                    <telerik:GridTemplateColumn Visible="false">
                        <ItemTemplate>
                            <asp:Label ID="lblFixedId" runat="server" Text='<%#Eval("FixedId") %>'></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridEditCommandColumn ButtonType="ImageButton" HeaderText="Edit" UniqueName="Edit" ItemStyle-Width="25px" HeaderStyle-HorizontalAlign="Center"
                        EditImageUrl="../Images/edit.gif" ItemStyle-HorizontalAlign="Center">
                    </telerik:GridEditCommandColumn>
                    <telerik:GridTemplateColumn HeaderText="Delete" UniqueName="Delete" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="40px" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:ImageButton runat="server" ID="imgdelete" OnClientClick="return confirm('Are you sure that you want to Delete?');"
                                ImageUrl="../Images/delete.gif" CommandName="Delete" CommandArgument="" />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                     
                    <telerik:GridTemplateColumn UniqueName="Jan" HeaderText="Jan" HeaderStyle-HorizontalAlign="Center" FooterStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="70px">
                        <ItemTemplate>
                            <asp:Label ID="lblJan" runat="server" Text='<%# string.Format("{0:n}", Convert.ToDecimal(Eval("Jan"))) %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtJanEdit" Width="70px" runat="server" MaxLength="11" Text='<%# string.Format("{0:n}", Convert.ToDecimal(Eval("Jan"))) %>' CssClass="AlgRgh"
                                onkeypress="javascript:return Allownumbersonly(event);" BorderWidth="1px"></asp:TextBox>
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <asp:TextBox ID="txtJanInsert" runat="server" Width="70px" MaxLength="11" CssClass="AlgRgh"
                                onkeypress="javascript:return Allownumbersonly(event);" BorderWidth="1px"></asp:TextBox>
                        </InsertItemTemplate>
                        <FooterTemplate>
                            <asp:Label ID="lblJanFooter" runat="server"></asp:Label>
                        </FooterTemplate>
                    </telerik:GridTemplateColumn>
                    
                </Columns>
            </telerik:GridTableView>
        </DetailTables>
        <Columns>
            <telerik:GridTemplateColumn HeaderText="AccountId" UniqueName="TempAccountsId" Visible="false">
                <ItemTemplate>
                    <asp:Label ID="lblTempAccountsId" runat="server" Text='<%#Eval("TempAccountsId") %>'></asp:Label>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn HeaderText="Account Number" UniqueName="AccountNumber" ItemStyle-Width="120px" HeaderStyle-Width="120px" HeaderStyle-HorizontalAlign="left" ItemStyle-HorizontalAlign="left">
                <ItemTemplate>
                    <asp:Label ID="lblAccountNumber" runat="server" Text='<%#Eval("AccountNumber") %>'></asp:Label>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn HeaderText="Account Name" UniqueName="AccountName" ItemStyle-Width="140px" HeaderStyle-Width="140px" HeaderStyle-HorizontalAlign="left" ItemStyle-HorizontalAlign="left">
                <ItemTemplate>
                    <asp:Label ID="lblAccountName" runat="server" Text='<%#Eval("AccountName") %>'></asp:Label>
                </ItemTemplate>
                <FooterTemplate>
                    <asp:Label ID="lbltotalFooter" runat="server" Text="Total:"></asp:Label>
                </FooterTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn HeaderStyle-Width="60" UniqueName="Jan" HeaderText="" ItemStyle-HorizontalAlign="Right"
                HeaderStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right"
                Aggregate="Sum" DataField="Jan" FooterAggregateFormatString="{0:n}">
            </telerik:GridTemplateColumn>
           
 
        </Columns>
    </MasterTableView>
    <ClientSettings AllowKeyboardNavigation="true" EnableRowHoverStyle="true">
        
    </ClientSettings>
</telerik:RadGrid>

protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            if (!e.IsFromDetailTable)
            {
                //DGeneral gen = new DGeneral();
                //RadGrid1.DataSource = gen.GetAccountDetailsbyTabName("Fixed");
                Dfixed fix = new Dfixed();
                RadGrid1.DataSource = fix.GetFixedAccountsDetails(Convert.ToInt32(Session["Propertyid"].ToString()), Convert.ToInt32(Session["BudgetYear"].ToString()));
            }
        }
 
protected void RadGrid1_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
        {
            Dfixed fix = new Dfixed();
            GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;
            switch (e.DetailTableView.Name)
            {
                case "Fixed":
                    {
                        int AccountID = Convert.ToInt32(dataItem.GetDataKeyValue("TempAccountsId").ToString());
                        e.DetailTableView.DataSource = fix.GetFixedByAccountId(AccountID, Convert.ToInt32(Session["BudgetYear"].ToString()), Convert.ToInt32(Session["Propertyid"].ToString()));
                        break;
                    }
 
                case "OrderDetails":
                    {
                        //string OrderID = dataItem.GetDataKeyValue("OrderID").ToString();
                        //e.DetailTableView.DataSource = GetDataTable("SELECT * FROM [Order Details] WHERE OrderID = " + OrderID);
                        break;
                    }
            }
        }
 protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
        {
            string exepUpdate = "";
            try
            {
                if (e.CommandName.Equals(RadGrid.UpdateCommandName))
                {
                    if (e.Item.OwnerTableView.Name == "Fixed")
                    {
                        bool ResultSuccess = false;
                        Dfixed fix = new Dfixed();
                        GridEditableItem item = e.Item as GridEditableItem;
                        Label lblFixedId = (Label)item.FindControl("lblFixedId");
                        int GenId = Convert.ToInt32(lblFixedId.Text.Trim().ToString());
                        TextBox txtDescriptionEdit = (TextBox)item.FindControl("txtDescriptionEdit");
                        TextBox txtJanEdit = (TextBox)item.FindControl("txtJanEdit");
                        if (txtJanEdit.Text.Trim().ToString() != string.Empty)
                        {
                            Jan = Convert.ToDouble(txtJanEdit.Text.Trim().ToString());
                        }
                        
                        total = Jan + Feb + Mar + Apr + May + Jun + July + Aug + Sep + Oct + Nov + Dec;
 
                        long? Retablesqfeet = fix.GetPropertyRentalsqfeet(Convert.ToInt32(Session["Propertyid"].ToString()));
 
                        double? genpersqft = total / Retablesqfeet;
 
                        ResultSuccess = fix.EditFixedDetails(GenId, Jan, Feb, Mar, Apr, May, Jun, July, Aug, Sep, Oct, Nov, Dec, total, genpersqft, txtDescriptionEdit.Text.Trim().ToString());
                        if (ResultSuccess)
                        {
                             RadGrid1.Rebind();
 
                        }
                        else
                        {
                            DisplayMessage("Please Verify the values");
                            e.Canceled = true;
                        }
                    }
                }
            }
            catch (Exception)
            {
                exepUpdate = "Please Verify the values you have changed in editable fields";
            }
            finally
            {
                if (exepUpdate != "")
                {
                    e.Canceled = true;
                    DisplayMessage("Fixed Record cannot be Updated. Reason: " + exepUpdate.ToString());
                }
            }
 
 
 
        }

 
Eyup
Telerik team
 answered on 17 Mar 2014
1 answer
90 views
The PivotGrid on my webpage is running very slowly when using Internet Explorer 10.  However, the performance is greatly improved when using Firefox instead.

As Internet Explorer 10 is part of my company's SOE, is there anything that can be done to improve the performance of the PivotGrid when using IE10 as the browser?
Galin
Telerik team
 answered on 17 Mar 2014
1 answer
57 views
Hi,
         In the treeview we have nodes that has child elements not visible , For this we add icon using rtPlus and rtMinus class. On the same treeview we have nodes that does not have any child.We need to place an icon . How do i target these nodes in CSS?


Shinu
Top achievements
Rank 2
 answered on 17 Mar 2014
1 answer
186 views
Hello,

I have many radgrids in my solution & most of them have export to excel feature implemented. Recently, we added Summay & Caption Statements to these grids in the ASPX files. In order not to show the Captions when the grid is displayed, I added a CSS class like "rgCaption" or "MasterTable_Default caption" or "DetailTable_Default caption".

Here is the example of the class.

.rgCaption
{
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    visibility: hidden;
    line-height: 0;
}


So when the grid is displayed in the webpage, the caption is hidden. I also want to do something similar when I do the export to excel (using CSS). Currently all my exported excels show the Caption which I don't want. I can always say Grid.MasterTable.Caption = String.Empty() in OnExcelExportCellFormatting or OnGridExporting. But this approach would make me edit all of the pages where export is involved & is too tedious & time-taking. I also tried 

Any Ideas?

Thanks
Bobby

Kostadin
Telerik team
 answered on 17 Mar 2014
1 answer
125 views
how to bind ad drop down tree with sqldata reader
Shinu
Top achievements
Rank 2
 answered on 17 Mar 2014
1 answer
122 views
So I have a kind of interesting problem here. I am using the Telerik control suite for ASP.NET AJAX, inside a number of custom user controls.

When assigning client side event handlers, I have changed my approach from defining functions at the window scope, to using the $create method to create an object for my control, and assigning the control's client side event to a method defined on the prototype. Here is the basic setup:

From an external js file:

function genericControl_init(sender, args){
  $create(GenericObject, sender);
}
 
function GenericObject(){};
GenericObject.prototype = {
  someFunction: function (sender, args) {
    console.log(this.someProperty)//undefined
    console.log(this);//this is not the GenericObject
  },
  get_id: function () { return this.id },
  set_id: function (id) { this.id = id },
  beginUpdate: function () { return true },
  endUpdate: function () { return true }
}

And on the page, generated in the code behind, this uses the control's ClientID for the id property on the JSON object:
genericControl_init({ "id": "ct101_someControl", "someProperty": "ct101_someControl_someClientID" });

and in the codebehind, to assign the event:
RadComboBox1.OnClientSelectedIndexChanged = String.Format("$find('{0}').{1}", ClientID, "someFunction");

This is just using a RadComboBox as an example, this happens with any Telerik control. Basically, it appears that the scope of this has changed when assigning the function as an event handler for a Telerik control and no longer references my GenericObject object.

A workaround I have found is storing the ClientID as an attribute on the Telerik control, and then grabbing it like sender.get_attributes().getAttribute('controlClientId') and using $find to get the reference to the original object and access it's individual properties. This feels sloppy though, and I was just wondering if anyone had a suggestion on how to better handle this.
Ivan Zhekov
Telerik team
 answered on 17 Mar 2014
8 answers
153 views
Hello!

I'm using RadProgressArea to display upload process progress. It's placed on the master page so that I don't need to add it on each page. It works well in IE, FF and Safari. But when I use Chrome, after the page performs the very first callback (from any control on the page), the following line in js code is causing an error and callbacks stop working at all. Here's the js code:

if
($telerik.RadUpload_isIFrameProgress){this._safariPoller.contentWindow.pollerInstance._startTime=new Date();


and the error is "Cannot set property _startTime of undefined". In debug mode it shows that pollerInstance is undefined.
I'm using v.2010.3.1109.35 of Telerik.Web.UI

Is it a know bug and if yes, has it been fixed in the latest version?
Thank a lot in advance!
Best,
Andy
Peter Filipov
Telerik team
 answered on 17 Mar 2014
1 answer
178 views
Here is my Code, Page_load method and RadGrid1_NeedDataSource.
The result is so weird, load in the 1 page, everything work find, when click next or 2nd page, the problem is occurs. The diagram show at Attach files.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 
        RadGrid1.ID = "RadGrid1"
        zzz.Controls.Add(RadGrid1)
 
        AddHandler Me.RadGrid1.NeedDataSource, New GridNeedDataSourceEventHandler(AddressOf Me.RadGrid1_NeedDataSource)
 
        RadGrid1.Visible = True
        RadGrid1.AllowPaging = True
        RadGrid1.AllowSorting = True
        RadGrid1.AllowMultiRowSelection = True
        RadGrid1.MasterTableView.AutoGenerateColumns = False
        RadGrid1.PageSize = 5
        RadGrid1.AutoGenerateColumns = False
        RadGrid1.MasterTableView.EditMode = GridEditMode.Batch
        RadGrid1.ClientSettings.Selecting.AllowRowSelect = True
        RadGrid1.EnableViewState = False
 
 
        RadAjaxManager1.EnableAJAX = True
 
    End Sub
 
 
 
Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs)
 
        Dim ConnString As String = ConfigurationManager.ConnectionStrings("myConnectionString").ConnectionString
        Dim conn As SqlConnection = New SqlConnection(ConnString)
        Dim adapter As SqlDataAdapter = New SqlDataAdapter
        adapter.SelectCommand = New SqlCommand("SELECT * FROM Product", conn)
 
        conn.Open()
        Try
            adapter.Fill(myDataTable)
        Finally
            conn.Close()
        End Try
        RadGrid1.DataSource = myDataTable
 
        Dim boundColumn As GridBoundColumn
 
        For Each col As System.Data.DataColumn In myDataTable.Columns
            boundColumn = New GridBoundColumn()
            RadGrid1.MasterTableView.Columns.Add(boundColumn)
            boundColumn.DataField = col.ColumnName
            boundColumn.HeaderText = col.ColumnName
 
 
            If col.ColumnName = "proID" Then
                'boundColumn.Visible = False
                boundColumn.HeaderText = "ProductID"
 
            ElseIf col.ColumnName = "proName" Then
                boundColumn.HeaderText = "Product Name"
 
            ElseIf col.ColumnName = "proQty" Then
                boundColumn.HeaderText = "Product Quantity"
 
            ElseIf col.ColumnName = "unitPrice" Then
                boundColumn.HeaderText = "Price"
            End If
 
        Next
    End Sub
Princy
Top achievements
Rank 2
 answered on 17 Mar 2014
1 answer
87 views
Hello,
In our Event logs we have a Warning indicating the rsAppointmentBg.png image cannot be found.  We do not reference any telerik images directly in our css, we only reference the dlls.  We are using the ASP.net Ajax RadScheduler.  How can we fix this issue? We are using Telerik.Web version 2013.1.417.40 with .Net Framework 4.0.

The actual error is:

An error occurred processing a web or script
resource request. The requested resource
'pTelerik.Web.UI.Skins|Telerik.Web.UI.Skins.Office2010Blue.Scheduler.rsAppointmentBg.png'
does not exist or there was a problem loading it. 

Thanks
Ivan Zhekov
Telerik team
 answered on 17 Mar 2014
3 answers
419 views
Hi All,

I've implemented a C# code-behind RadComboBox with a SqlDataSource and RadComboBoxFilter.Contains in order to provide search-box-like functionality to the users.  I run my code with the selected value using a RadButton. 

The Users would like to be able to just hit enter or click on the desirable values to initiate the filter process.  The SelectedIndexChanged method does not appear to be firing.  I have AutoPostBack = true.  Being able to just type and enter would be the most desirable option.  Can anyone please help?

Thanks,
Mark

Shinu
Top achievements
Rank 2
 answered on 17 Mar 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?