Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
121 views
When exporting my grid to HTML everything works fine. I recently changed the formatting to BIFF and am seeing a problem with the header text on the dynamically added gridbound columns. For some reason, on these columns only, the header text is being repeated (ex Long NameLong Name). I also have dynamic template columns in my grid and they export just fine in BIFF.

As I said, this all works just fine with the HTML format.

Has anyone else seen this problem?
Thanks in advance for your help. 

Code to add new column
bfield = new Telerik.Web.UI.GridBoundColumn();
bfield.AllowFiltering = true;
bfield.AllowSorting = true;
bfield.SortExpression = colName.AttributeName;
bfield.ShowSortIcon = true;
radGrid.MasterTableView.Columns.Add(bfield);
bfield.DataField = colName.AttributeName;
bfield.HeaderText = colName.DisplayName;
bfield.UniqueName = colName.DisplayName.Replace(" ", string.Empty);
bfield.HeaderStyle.Font.Size = 10;


Code to export
radGrid.ExportSettings.OpenInNewWindow = true;
radGrid.ExportSettings.ExportOnlyData = false;
radGrid.ExportSettings.IgnorePaging = true;
radGrid.ExportSettings.Excel.Format = GridExcelExportFormat.Biff;
radGrid.MasterTableView.ExportToExcel();
Robin
Top achievements
Rank 1
 answered on 07 Feb 2013
2 answers
291 views
Hi,

How to display RadWindowManager.RadAlert from shared ( static ) method. My scenario is as follows:

1. When a user click on a button a java script function is executed with that code:
Page.ClientScript.RegsterStartupScript(Me.GetType(), "alert", "OpenActiveX();", True)

2. After javascript function finished its work I call a static function into asp.net code behaind with PageMethods
function OpenActiveX() {
    try {
        var xml = document.getElementById('MainContent_XmlTextReference').value;
        ...
        PageMethods.SaveXmlFile(xml)
    }
    catch (Err) {
        alert(Err.description);
    }
}

and here is how SaveToXml method is defined

<Services.WebMethod()> _
    Public Shared Function SaveXmlFile(ByVal xml As String) As Boolean
        ' work with returned from java script data
 
         Here need to display an alter when work with data is finished
 
        Return True
    End Function


I have 

Public Class MyPage
    Inherits System.Web.UI.Page
 
    Private Shared MyPageHandle As MyPage
 
    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Try
                MyPageHandle = Me
                ...
        End If
    End Sub
 
    <Services.WebMethod()> _
    Public Shared Function SaveXmlFile(ByVal xml As String) As Boolean
        ...
 
        MyPageHandle.RadWindowManager1.RadAlert("test", 100, 100, "test", 0)
 
        Return True
    End Function
End Class

add a RadWindowManager to web page named and after that try to call it from shared method
without success

Thank you

Kosta
Top achievements
Rank 1
 answered on 07 Feb 2013
2 answers
78 views
Hi,

I have a radgrid in which i have paging enabled. The pager style is numeric. When i mouse over the pager links (1, 2, 3,... etc numbers) i am not seeing a title on them. Can anyone please suggest if i can enable titles on these while constructing the pager itself?

Thanks,

Swamy.
Swamy
Top achievements
Rank 1
 answered on 07 Feb 2013
1 answer
209 views

 Radgrid is not refreshing at client side but at the server side radgrid contains Newly added row ,
I added a keydown event for the textbox "txtPartDescription" 
  in the Keydownevent i handled Tab key  ,  i called Radajaxmanager_ajaxRequesr("Newrow") to insert new row into datasource and i assigned data source to radgrid . but radgrid is not refreshing at the browser it showing old data and also client event s are not working after binding .

Thanks in advance .
   Please suggest any other approach to handle this  .
  please check the below code  

        protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
        {
            if (e.Argument == "NewRow")
            {
                if (Session["dtOld"] != null)
                {
                    DataTable dt = (DataTable)Session["dtOld"];
                    DataRow dr = dt.NewRow();
                    dt.Rows.Add(dr);
                    grdParts.DataSource = dt;
                    grdParts.MasterTableView.Rebind();
                    //    grdParts.DataBind();
                    Session["dtOld"] = dt;

                }
            }
            else
            {

                DataTable dtRecords = new DataTable();
                dtRecords.Rows.Clear();
                foreach (GridColumn col in grdParts.Columns)
                {
                    DataColumn colString = new DataColumn(col.UniqueName);
                    dtRecords.Columns.Add(colString);

                }
                foreach (GridDataItem row in grdParts.MasterTableView.Items) // loops through each rows in RadGrid
                {
                    TextBox txt = (TextBox)row.FindControl("txtPartNumber");
                    string v = txt.Text;
                    DataRow dr = dtRecords.NewRow();
                    foreach (GridColumn col in grdParts.Columns) //loops through each column in RadGrid
                        dr[col.UniqueName] = row[col.UniqueName].Text;
                    dtRecords.Rows.Add(dr);
                }
                Session["save"] = dtRecords;
            }
        }
  <script type="text/javascript">
            var editedCell;
            var arrayIndex = 0;
            var editedItemsIds = [];
            function RowCreated(sender, eventArgs) {
                alert("row created");
                var dataItem = eventArgs.get_gridDataItem();

                for (var i = 0; i < dataItem.get_element().cells.length; i++) {
                    var cell = dataItem.get_element().cells[i];
                    if (cell) {
                        $addHandler(cell, "dblclick", Function.createDelegate(cell, ShowColumnEditor));
                    }
                }
            }
            function RowClick(sender, eventArgs) {
            
                if (editedCell) {
             
                    if ((eventArgs.get_domEvent().target.tagName == "TD") ||
                        (eventArgs.get_domEvent().target.tagName == "SPAN" && !eventArgs.get_domEvent().target.className.startsWith("rfd"))) {
                        alert("up");
                        UpdateValues(sender);
                        editedCell = false;
                    }
                }


            }
            function UpdateValues(grid) {
                alert("up");
               
                var tHeadElement = grid.get_element().getElementsByTagName("thead")[0];

                var headerRow = tHeadElement.getElementsByTagName("tr")[0];

                var colName = grid.get_masterTableView().getColumnUniqueNameByCellIndex(headerRow, editedCell.cellIndex);

              
                switch (colName) {
                    case "PartNumber":
                        HideEditor(editedCell, "textbox");
                        break;
                    case "PartDescription":
                        HideEditor(editedCell, "textbox");
                        break;

                    default:
                        break;
                }
            }
            function HideEditor(editCell, editorType) {
            
                var lbl = editCell.getElementsByTagName("span")[0];



                switch (editorType) {
                    case "textbox":
                        var txtBox = editCell.getElementsByTagName("input")[0];
                        if (lbl.innerHTML != txtBox.value) {
                            lbl.innerHTML = txtBox.value;
                            editCell.style.border = "1px dashed";

                        }
                        txtBox.style.display = "none";


                        break;
                    default:
                        break;
                }
                lbl.style.display = "inline";
            }
            function RowDestroying(sender, eventArgs) {
            
                var row = eventArgs.get_gridDataItem().get_element();
                var cells = row.cells;
                for (var j = 0, len = cells.length; j < len; j++) {
                    var cell = cells[j];
                    if (cell) {
                        $clearHandlers(cell);
                    }
                }

            }
            function ShowColumnEditor() {
                editedCell = this;

             
                var cellText = this.getElementsByTagName("span")[0];
                cellText.style.display = "none";

                var colEditor = this.getElementsByTagName("input")[0];
           
                colEditor.style.display = "";
                colEditor.focus();
            }
            function ProcessChanges() {
            

                $find("<%=RadAjaxManager1.ClientID%>").ajaxRequest();
        
                return false;
     

            }
            function KeyPress(event, indx) {

                if (event.keyCode == 9) {
                    var grid = $find("<%=grdParts.ClientID%>");
                    var MasterTable = grid.get_masterTableView();
                    var Rows = MasterTable.get_dataItems();
                    alert(Rows.length);
                    $find("<%=RadAjaxManager1.ClientID%>").ajaxRequest("NewRow");

                    $find("<%= grdParts.ClientID %>").get_masterTableView().rebind();
                    var r = $find("<%= grdParts.ClientID %>").get_masterTableView().get_dataItems();
                    alert(r.length);
                }

            }
       
        </script>
<telerik:RadGrid runat="server" ID="grdParts" Width="300" AutoGenerateColumns="false"
                    AllowAutomaticInserts="true" >
                    <MasterTableView EditMode="InPlace" CommandItemDisplay="Bottom" >
                       <CommandItemTemplate>
                            <asp:Button ID="Button1" Text="Add new item" runat="server"  CommandName="InitInsert" OnClick="btnaddnew_Click">
                            </asp:Button>
                        </CommandItemTemplate>
                        <Columns>
                            <telerik:GridTemplateColumn HeaderText="PartNumber" UniqueName="PartNumber">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lblPartNumber" Height="25" Text='<%#Eval("PartNumber")%>'></asp:Label>
                                    <asp:TextBox runat="server" ID="txtPartNumber" Height="25" Text='<%#Eval("PartNumber")%>'
                                        Style="display: none" ></asp:TextBox>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="PartDescription" UniqueName="PartDescription">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lblPartDescription" Height="25" Text='<%#Eval("PartDescription")%>'></asp:Label>
                                    <asp:TextBox runat="server" ID="txtPartDescription" Height="25" Text='<%#Eval("PartDescription")%>'
                                        Style="display: none"></asp:TextBox>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                        </Columns>
                    </MasterTableView>
                    <ClientSettings>
                        <ClientEvents OnRowCreated="RowCreated" OnRowClick="RowClick" OnRowDestroying="RowDestroying">
                        </ClientEvents>
                    </ClientSettings>
                </telerik:RadGrid>
Angel Petrov
Telerik team
 answered on 07 Feb 2013
1 answer
119 views
I am using Moss 2007 with Rad Controls.  In one of my sharepoint pages i am having a RadHtmlField control.  When i Click on the "Image manager" icon in the control a list of folders show up in a popup. 

Was trying to find out where these folders are configured, so that I can change to a different folder.  Can you please help.

Thanks,
Mike

 

Rumen
Telerik team
 answered on 07 Feb 2013
1 answer
181 views
Telerik,

Are there any examples/tutorials that have radtabstrip and radmultipage with radpageview load on demand contenturl?

I want to be able to load a pageview with a contenturl on demand.  Something like the following:
http://demos.telerik.com/aspnet-ajax/tabstrip/examples/applicationscenarios/loadondemand/defaultcs.aspx

but with contenturl instead of usercontrol.

Thanks.
Kate
Telerik team
 answered on 07 Feb 2013
0 answers
79 views

I'm populating a treeview in c# asp.net and have bound data to it, all well and displays as it should. my problem now is that i'm looking to save any modifications to the checkboxes i.e if a user clicks an additional box and saves but i the checked state will stay false.

here's what i have so far which iterates through what was initially loaded and not what has been changed, I've tried many variations but haven't managed to get it working - anyone any ideas??

public void saveCheckedItems()
{

    if (treeListItems.CheckedNodes.Count > 0)
    {
        IList<RadTreeNode> allNodes = treeListItems.GetAllNodes();

        for (int i = 0; i < allNodes.Count; i++)
        {
            RadTreeNode node = (RadTreeNode)allNodes[i];
            string fileid = node.Value.ToString();
            if (node.Checked == true)
            {
                if (fileid.Length == 12)
                {
                    saveTreeChanges(Page.Request.QueryString["ID"], fileid,connectionStr);
                }
            }
        }
    }
}

edit -

creating treeview as follows

<telerik:RadTreeView ID="treeListItems" runat="server" CheckBoxes="True" Height="320px"
                            TriStateCheckBoxes="true" CheckChildNodes="true" Skin="WebBlue" CssClass="table table-bordered" OnNodeDataBound="RadTreeView1_NodeDataBound" >
                        </telerik:RadTreeView>

binding data like this

public void loadTreeList()
        {
            DataTable dt = treeMan.getTreeList(connectionStr);
            treeListItems.DataTextField = "Description";
            treeListItems.DataValueField = "FieldID";
            treeListItems.DataFieldID = "FieldID";
            treeListItems.DataFieldParentID = "ParentID";
            treeListItems.DataSource = dt;
            treeListItems.DataBind();
            treeListItems.ExpandAllNodes();
        }

in the example im testing its a 3 tier tree and one element is checked on third tier. When i click more items only this already checked item is visible in the list

Ciaran
Top achievements
Rank 1
 asked on 07 Feb 2013
3 answers
1.6K+ views

I am getting the Invalid length issue frequently in my application. Using of SessionPageStatePersister from earlier implementation  hiddenfieldpagestatepersister did not resolve the issue.

Can any body please help me out?

[FormatException: Invalid length for a Base-64 char array.]
at System.Convert.FromBase64String(String s)
at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString)
at System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String\ serializedState)
at System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String\ serializedState)
at System.Web.UI.SessionPageStatePersister.Load()

[HttpException: The state information is invalid for this page and might be corrupted.]
at System.Web.UI.SessionPageStatePersister.Load()
at Telerik.Web.UI.RadSessionPageStatePersister.Load()
at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
at System.Web.UI.Page.LoadAllState()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,\ Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint,\ Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.pages_appeal_appealaction_aspx.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Martin
Telerik team
 answered on 07 Feb 2013
1 answer
96 views
I am looking for a client or codebehind method to change the size of the Template Manager's iframe to match the sizing from User's template html.  A User will uploads various sized html templates and we want to adjust the size of the preview in iframe accordingly.   
Cheers,
Rumen
Telerik team
 answered on 07 Feb 2013
3 answers
107 views
HI All

We are getting an error while trying to upload an image using RadEditor Control. We are getting a javascript error.

Message: Object doesn't support this property or method
URI: /ScriptResource.axd?d=...........................

Message: Sys.ArgumentException:  does not derive from Sys.Component.
URI: /ScriptResource.axd?d=................................................


Don't know what is happening but the same control works in a different server where  we could upload images.

But in 2 other servers we get an error as mentioned above while uploading an image.

Thanks

Rumen
Telerik team
 answered on 07 Feb 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
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?