Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
158 views
Hi Telerik.

I was looking in forums for excel 2010 support in Telerik Rad Grid.
As currently when we export to excel it prompts following message:

The file you are trying to open, '[filename].xls', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?

Which users find annoying. When I was going through  forums I had read that you are going to add support for excel 2010 in Q3-Q4 2012.
However didn't find any concrete answers yet on this release.

Could you please let us know whether the support for excel 2010 has been released for Telerik Rad Grid which will also suppress above message?

Thanks,
Aditi
Kostadin
Telerik team
 answered on 09 Sep 2013
1 answer
208 views
Hello Telerik Team,

I am having a problem when rebind the grid on second time with same data source . Everything is same . When first time i call the Rebind function it works fine but on second time it throws Syntax error: Missing operand before 'is' operator. Please help me.

Here is my code
Aspx file
 <telerik:RadGrid ID="rdGridDetailTable" runat="server" AllowSorting="true" Height="400px"
                                                                                    GridLines="both" AutoGenerateColumns="false" OnDetailTableDataBind="rdGridDetailTable_DetailTableDataBind"
                                                                                    OnNeedDataSource="rdGridDetailTable_NeedDataSource" AutoGenerateHierarchy="true"
                                                                                    MasterTableView-ExpandCollapseColumn-HeaderStyle-Width="30px">
                                                                                    <MasterTableView>
                                                                                    </MasterTableView>
                                                                                    <ClientSettings>
                                                                                        <Scrolling AllowScroll="True" SaveScrollPosition="True"></Scrolling>
                                                                                    </ClientSettings>
                                                                                    <HeaderStyle CssClass="HeaderRow" />
                                                                                    <CommandItemStyle BorderColor="#003399" BorderStyle="Solid" BorderWidth="1px" />
                                                                                    <FilterMenu EnableImageSprites="False">
                                                                                    </FilterMenu>
                                                                                    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
                                                                                    </HeaderContextMenu>
                                                                                </telerik:RadGrid>

aspx.cs


   #region Show Graphs
        private void ShowTable(string value)
        {
                    chartHolder.Controls.Clear();
                    DataSet ds = CalculateAttractivity();
                    PopulateTable(ds.Tables[0], ds.Tables[1]);
                    break;
            
        }
        #endregion


        #region populate table
        private void PopulateTable(DataTable dtData, DataTable dtDataDetails)
        {
            if (GridStructure == false)
            {
                DefineGridStructure(dtData, dtDataDetails);
            }
            trUserDataArea1.Style.Add(" background-color", GraphMin.BackColor.ToString());
            tblDetails.Style.Add("display", "block");
            tblDetails.Visible = true;
            chartHolder.Visible = false; //showing chart 
            Attractivity = dtData;
            AttractivityDetails = dtDataDetails;
            rdGridDetailTable.Rebind();
        }
        #endregion

 #region RadGrid Structure
        private void DefineGridStructure(DataTable dtData, DataTable dtDetail)
        {
            SystemLocalizationBO systemLocalizationBO = new SystemLocalizationBO(true);
            SystemSession sys = hdr.SysSession;
            var weight = SessiontblComponentModel1.Rows.Cast<DataRow>().Select(row => row[10].ToString()).ToArray();
            rdGridDetailTable.Columns.Clear();
            rdGridDetailTable.MasterTableView.Columns.Clear();
            rdGridDetailTable.MasterTableView.DataKeyNames = new string[] { dtData.Columns[0].ColumnName };
            rdGridDetailTable.Width = Unit.Percentage(98);
            rdGridDetailTable.MasterTableView.HierarchyLoadMode = GridChildLoadMode.Client;
            rdGridDetailTable.MasterTableView.DataMember = "Table";
            rdGridDetailTable.AutoGenerateColumns = false;
            string strTable = "<table><tr><td>";
            //Add columns
            int Count = 0;
            foreach (DataColumn dc in dtData.Columns)
            {
                strTable = "<table><tr><td>";
                GridBoundColumn boundColumn;
                boundColumn = new GridBoundColumn();
                boundColumn.DataField = "[" + dc.ColumnName + "]";

                if (Count > 2)
                {
                    strTable = strTable + dc.ColumnName + "</td></tr><tr><td>";
                    strTable = strTable + weight[Count - 3] + "</td></tr></table>";
                    boundColumn.HeaderStyle.Width = 10;
                    boundColumn.HeaderText = strTable;
                    boundColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
                    boundColumn.HeaderStyle.VerticalAlign = VerticalAlign.Middle;
                }
                else
                {
                    
                    boundColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
                    boundColumn.HeaderStyle.VerticalAlign = VerticalAlign.Middle;
                    if (Count == 1)
                    {
                        strTable = strTable + dc.ColumnName + "</td></tr><tr><td>";
                        strTable = strTable + systemLocalizationBO.GetErrorMessage(31075, sys.CurrentUserLanguage.ToString()) + "</td></tr></table>";
                        boundColumn.HeaderText = strTable; 
                    }
                    else
                    {
                        strTable = strTable + dc.ColumnName + "</td></tr><tr><td>";
                        strTable = strTable  + "&nbsp;</td></tr></table>";
                        boundColumn.HeaderText = strTable;
                    }
                }
                rdGridDetailTable.MasterTableView.Columns.Add(boundColumn);
                Count++;
            }
            //Detail table - Orders (II in hierarchy level)
            GridTableView tableViewOrders = new GridTableView(rdGridDetailTable);
            tableViewOrders.Columns.Clear();
            tableViewOrders.Width = Unit.Percentage(100);
            tableViewOrders.DataKeyNames = new string[] { dtData.Columns[0].ColumnName };
            tableViewOrders.DataMember = "Table";
            GridRelationFields relationFields = new GridRelationFields();
            tableViewOrders.ParentTableRelation.Add(relationFields);
            relationFields.MasterKeyField = dtData.Columns[0].ColumnName;
            relationFields.DetailKeyField = dtData.Columns[0].ColumnName;
           
            rdGridDetailTable.MasterTableView.DetailTables.Add(tableViewOrders);
            //Add columns
            Count = 0;
            foreach (DataColumn dc in dtDetail.Columns)
            {
                GridBoundColumn boundColumn;
                boundColumn = new GridBoundColumn();
                boundColumn.DataField = "[" + dc.ColumnName + "]";
                boundColumn.HeaderText = dc.ColumnName;
                if (Count == 0)
                {
                    boundColumn.Visible = false;
                }
                tableViewOrders.Columns.Add(boundColumn);
                Count = 1;
            }
            GridStructure = true;
        }
        #endregion

   protected void rdGridDetailTable_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            if (Attractivity != null)
            {
                rdGridDetailTable.DataSource = Attractivity;
                rdGridDetailTable.MasterTableView.DetailTables[0].DataSource = AttractivityDetails;
            }
        }


protected void rdGridDetailTable_DetailTableDataBind(object sender, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
        {
            try
            {
                GridDataItem parentItem = e.DetailTableView.ParentItem as GridDataItem;
                if (parentItem.Edit)
                {
                    return;
                }
                if (parentItem.GetDataKeyValue(AttractivityDetails.Columns[0].ColumnName).ToString() != string.Empty)
                {
                    e.DetailTableView.DataSource = AttractivityDetails.Select(AttractivityDetails.Columns[0].ColumnName + " = '" + parentItem.GetDataKeyValue(AttractivityDetails.Columns[0].ColumnName).ToString() + "'").CopyToDataTable();
                }
                
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

Thanks in advance

Nishant Mittal
Kostadin
Telerik team
 answered on 09 Sep 2013
7 answers
232 views
I have a radgrid that has been performing perfectly until i upgraded to 2013.1.417.40 yesterday. 

My grid is inside a radpanelitem.  The edit form is set to be a modal popup and worked as expected prior to the recent upgrade.  Now, the popup is restricted to the radpanelitem and barely visible depending on the size of the radpanelitem.

If the edit form popup is visible, i can grab it and move it, but only within the confines of the radpanelitem container.  It should pop over the entire window (as it used to.)  I have other grids that are not contained in the radpanelitem and those pop properly.  

Anyone encounter this or have a solution?  I have tried messing with z-index settings but that isn't getting me anywhere. 
Sasa
Top achievements
Rank 1
 answered on 09 Sep 2013
1 answer
87 views
Hi All,

I am using radgrid which was working fine for a long time.

But recently the css got changed in the server.

I checked it in the local machine it works fine. I even checked the code, both are exactly the same.

This happened before two weeks, But I am not sure about it.

Is there any way to solve this.

Have attached both the screen shots in local and in server.

-Anto

Venelin
Telerik team
 answered on 09 Sep 2013
1 answer
86 views
hi, I just used radautocomplete box, it works fine but returns record as "System.data.datarowview". Can you please let me know why this is happening? thank you
Shinu
Top achievements
Rank 2
 answered on 09 Sep 2013
2 answers
140 views
I'm using the Rad Grid to sort via drag and drop, which is working pretty great. I'm also using a textbox and imagebutton as a second method of sorting my data. To do this I am passing the RowIndex to the ItemCommand then using that rowindex to find my textbox with the new sortID value in it. For some reason it looks like inside the ItemDataBound of the RadGrid The RowIndex gets doubled and it would also seem it uses a 1 based index instead of a 0 based. When i try to find the control using that index it wants to use a zero based index and the doubled index also causes error. I've fixed the problem by dividing the rowindex by 2 and then subtracting 1 for the 0 based index. This solution actually seems to be working fine. However, I don't like using a hack that I don't fully understand. The follow code works, but I'd like to know why i have to divide by 2 and subtract 1 in order for it to work correctly. Look at this line  iRowIndex = (iRowIndex / 2) - 1


Protected Sub rgList_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgList.ItemCommand
 
        If TypeOf e.CommandSource Is ImageButton AndAlso CType(e.CommandSource, ImageButton).ID = "btnSort" Then
 
            Dim iEntityID As Integer = 0
            iEntityID = e.CommandArgument.ToString.Split("|")(0)
 
            Dim iRowIndex As Integer
            iRowIndex = e.CommandArgument.ToString.Split("|")(1)
 
            iRowIndex = (iRowIndex / 2) - 1
 
            Dim iNewSortID As Integer = 0
            Dim txtSortID As TextBox
            txtSortID = rgList.Items(iRowIndex).FindControl("txtSortID")
 
            If IsNumeric(txtSortID.Text) AndAlso txtSortID.Text > 0 Then
                iNewSortID = txtSortID.Text
 
                If iEntityID > 0 Then
                    Dim oItem As New CollectTech.Items.Item(iEntityID)
 
                    If oItem.SortID <> iNewSortID Then
                        oItem.SortID = iNewSortID
                        oItem.UpdateSortID()
                        oItem.Dispose()
                    End If
                End If
            End If
 
            LoadData()
        End If
 
    End Sub
 
    Protected Sub rgList_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles rgList.ItemDataBound
 
        If e.Item.ItemType = Telerik.Web.UI.GridItemType.Item OrElse e.Item.ItemType = Telerik.Web.UI.GridItemType.AlternatingItem Then
 
            Dim oItem As CollectTech.Items.Item = e.Item.DataItem
            Dim litItemName As Literal = e.Item.FindControl("litItemName")
            Dim txtSortID As TextBox = e.Item.FindControl("txtSortID")
            Dim btnSort As ImageButton = e.Item.FindControl("btnSort")
 
            litItemName.Text = Server.HtmlEncode(oItem.Name)
 
            txtSortID.Text = oItem.SortID
 
            btnSort.CommandArgument = oItem.ID & "|" & e.Item.RowIndex
 
            imgThumbnail.ImageUrl = sImagePath
        End If
 
    End Sub
 
Dave
Top achievements
Rank 1
 answered on 09 Sep 2013
1 answer
45 views
Hi.I call javascript function in server side in Grid ItemCommand event :

protected void grd_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName != "Update") return;
            ClientScript.RegisterStartupScript(GetType(), "test", " $('#element_to_pop_up').bPopup({ speed: 650, transition: 'slideIn' });", true);
            var item = e.Item as GridDataItem;
            var id = item["colID"].Text;
            txtName.Text = item["col"].Text;
            lblMsg.Visible = false;
            Session["MeasureId"] = id;
        }

When I put my gird into my Button UpdatedControls , my javascript function doesn't work  and my popUp menu doesn't show ....

 <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="btnSave">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="txtName" />
                    <telerik:AjaxUpdatedControl ControlID="lblMsg" />
                    <telerik:AjaxUpdatedControl ControlID="grd" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>

my PopUp is :

<div id="element_to_pop_up" style="border: thin solid #400000; padding-top: 30px; display: none; font-family: tahoma; font-size: small; width: 400px; float: right; direction: rtl; background-color: white">

        <div style="float: right; padding-right: 10px">
           Unit Name : &nbsp;
        </div>
        <div style="float: right">
            <telerik:RadTextBox ID="txtName" runat="server" Font-Names="tahoma">
            </telerik:RadTextBox>
        </div>
        <div style="width: 100%; float: left;">
            <div style="padding-top: 20px; padding-right: 10px">
                <asp:Label ID="lblMsg" runat="server" Text="Label" ForeColor="Maroon" Visible="False"></asp:Label>
            </div>
            <div style="padding: 20px; float: left">
                <telerik:RadButton ID="btnSave" runat="server" Text="Save" Font-Names="Tahoma" Skin="Office2010Black" Width="100px" Height="30px" ButtonType="LinkButton" OnClick="btnSave_Click"></telerik:RadButton>
            </div>
        </div>
    </div>
Shinu
Top achievements
Rank 2
 answered on 09 Sep 2013
3 answers
206 views
Hi,

I have a RadAutoCompleteBox and a CSS style to color the box differently depending on if the box is disabled or not.
Everything works fine except for when I have the AllowCustomEntry set to true.
When set to false (And the control disabled), the background and fore color both change to the color I want.
When set to true (And the control disabled), the background color changes, however, the fore color remains the same.

Code:
<telerik:RadAutoCompleteBox ID="ACP_Name" runat="server" DropDownHeight="150px"
Skin="Default" DropDownWidth="200px" Style="z-index: 1; left: 220px; top: 167px;
position: absolute; height: 22px; width: 210px" OnClientRequesting="OnClientRequesting"
InputType="Text" AllowCustomEntry="True" TextSettings-SelectionMode="Single">
<WebServiceSettings Method="GetName" Path="MyWebService.asmx" />
</telerik:RadAutoCompleteBox>



CSS:
div.RadAutoCompleteBox_Default .racDisabled
        {
            background-color: #000099;
            border-color: #FFFFFF;
            color: #CCCCCC;
        }


Is there anything I can do to get the text color to change when the AllowCustomEntry is set to true?


Thanks!


Princy
Top achievements
Rank 2
 answered on 09 Sep 2013
3 answers
138 views
Hi,
After selecting date in Rad calendar, the calendar wrapper div create following inline style. But due to postion absolute my page UI is distrubing . I want to override this style into position fixed. Can you please suggest a way to overried this inline style.

<div id="ctl00_ContentPlaceHolder1_txtEndDate_calendar_wrapper" style="visibility: hidden; position: absolute; left: -1000px;
Shinu
Top achievements
Rank 2
 answered on 09 Sep 2013
1 answer
103 views
I am doing simple data binding with a Grid.  That part works fine.  I also have a dropdownlist control where the user can select different time periods for the query the supplies the grid.  When the user changes a selection in the dropdownlist, the control is posting back but the grid never updates.  I can't quite tell what the problem is.  What should I be looking for?

Princy
Top achievements
Rank 2
 answered on 09 Sep 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
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
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
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
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?