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

I am trying to create a demo of RadGrid in sharepoint. So basically showing some sharepoint data in the grid. I have tried 2 approaches so far and the issues i am facing with are as below:

1. UserControl with RadSkinManager, RadFormDecor, RadGrid and Skin im using is Windows7. The issue here is that when drag a column to group to the GroupPanel, the display goes haywire as shown in attachment(RadGridGrouping.Jpg) and also since i have more than 15 columns & have enabled scrolling the page when first loading shows the RadGrid with full width first for a few seconds and then shrinks to with the page width and scrollbar.

2. Programmatically creating the RadGrid as shown in the example here. The issue here is that when drag a column for grouping to the GroupPanel an error is thrown as shown in the screen shot. (RadGridError.jpg)

Please advice.

Note:
The RadScriptManager is placed in the MasterPage and the MOSS site has a custom theme applied. Also do not have <xhtmlConformance /> in webconfig.

Veli
Telerik team
 answered on 25 Feb 2010
1 answer
57 views
I'm using Telerik.Web.UI, 2009.1.311.35 with Clear Formatting in the menu.

I'm checking things with Firebug on FireFox 3.6. I can track the iframe, containing the dynamically loaded styles + its dynamically populated body.

Now, when I do <CTRL> + <A> to select all text within the editor, and I click "Clear Formatting", formatting is indeed removed, but the same goes for the <body>-tag. All content ends up bungling directly within the html tag, right after the <head>. This messes up some styles.

I also noticed this problem does not occur at the online demos for ASP.NET AJAX.

Has this been a know issue in the past and was it fixed? I'd like to know before I go into yet another update round.
Rumen
Telerik team
 answered on 25 Feb 2010
1 answer
142 views
I want to create a web control that has a RadInputmanager , and i am having the follow exception .
[NullReferenceException: Object reference not set to an instance of an object.]
System.Web.UI.Control.FindControl(String id, Int32 pathOffset) +219
System.Web.UI.Page.FindControl(String id) +38
Telerik.Web.ChildControlHelper.FindControlRecursive(Control searcher, String ID) +68
Telerik.Web.UI.RadInputManager.PopulateInputCollection() +401
Telerik.Web.UI.RadInputManager.OnPreRender(EventArgs e) +454
System.Web.UI.Control.PreRenderRecursiveInternal() +90


here is the base code
   private RadInputManager inputManger = new RadInputManager();
        private TargetInput target = null;
        CPFTextString cText = new CPFTextString(); // ibased om  public class CPFTextString : RegExpTextBoxSetting
        public CPFControl()
            : base()
        {

        }

        protected override void OnInit(EventArgs e)
        {
            
            target = new TargetInput(cBox.ID,true );
            cText.TargetControls.Add(target);
            inputManger.InputSettings.Add(cText);
            Controls.Add(inputManger);
            base.OnInit(e);
        }



Iana Tsolova
Telerik team
 answered on 25 Feb 2010
5 answers
271 views

Hi, 
      I am creating dynamic columns in the Radgrid. The first olumn is checkbox box column and the other columns are as per to the user selected criteria. There can be a link column also which will open new page. 
I get the datatable according to the user search criteria, hence I am getting different types of columns every time.
Following code shows the aspx page for radgrid display.

 

<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">  
                                     <ContentTemplate>  
                                         <telerik:RadGrid ID="rgResult" runat="server" BorderColor="Black" BorderStyle="Solid" 
                                             BorderWidth="1px" AllowPaging="true" AllowSorting="true"  AutoGenerateColumns="false" PageSize="8">  
                                             <MasterTableView>  
                                                                                             <PagerStyle Mode="NextPrev" Font-Size="11px" Font-Names="Arial" PagerTextFormat="Change page: {4} Item {3} of {5}" />  
                                                 <ItemStyle Font-Size="11.5px" HorizontalAlign="Left" />  
                                                 <AlternatingItemStyle Font-Size="11.5px" HorizontalAlign="Left" />  
                                                 <RowIndicatorColumn>  
                                                     <HeaderStyle Width="20px" />  
                                                 </RowIndicatorColumn>  
                                                 <ExpandCollapseColumn ItemStyle-Wrap="true">  
                                                     <HeaderStyle Width="20px" />  
                                                 </ExpandCollapseColumn>  
                                             </MasterTableView>  
                                         </telerik:RadGrid>  
                                     </ContentTemplate>  
                                 </asp:UpdatePanel> 

And the bind function I am calling is given

Public Sub BindNewGrid()  
        Try 
            Dim attachFlag As Boolean = False 
            Dim dt As New DataTable  
            Dim dtLoad As New DataTable  
            Dim lstHeader As New ListBox  
            Dim ShowMe As String = CType(Session("ShowMe"), String)  
            Dim chkflag As Boolean = False 
            'gets the data from session variable   
            dt = CType(Session("dtSearch"), DataTable).Copy  
 
            'checks is Display Columns are selected  
            lstHeader = GetDisplayColList()  
 
            rgResult.MasterTableView.DataSource = dt  
 
             For Each item As ListItem In lstHeader.Items  
                For i As Integer = 0 To dt.Columns.Count - 1  
                    Dim ProID As String = GetDatatableID()  
                    If Not chkflag Then 
                        If item.Value.ToLower = "keep" Then  'for checkbox column  
                            Dim templateColumn As New GridTemplateColumn()  
                            templateColumn.ItemTemplate = New GridCheckboxTemplate(ProID)  
                            ' templateColumn.HeaderImageUrl = "images/delete.gif"  
                            templateColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center  
                            templateColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Left  
                            templateColumn.ItemStyle.VerticalAlign = VerticalAlign.Middle  
                            templateColumn.HeaderStyle.Width = Unit.Pixel(23)  
                            templateColumn.ItemStyle.Width = Unit.Pixel(35)  
                            templateColumn.HeaderText = "Keep" 
                            rgResult.MasterTableView.Columns.Add(templateColumn)  
                            chkflag = True 
                            Exit For 
                        End If 
                    End If 
                     
                    If item.Value.ToLower = dt.Columns(i).ColumnName.ToLower Then 
                       If item.Value.ToLower = ProID.ToLower Then  'if ID Field linkbutton  
                            Dim Tempcol As New GridTemplateColumn  
                            Tempcol.ItemTemplate = New MyTemplate(dt.Columns(i).ColumnName, ProID, False, ShowMe)  
 
                            Tempcol.HeaderText = item.Text  'drow("DisplayName") 'GetDisplayName(dt.Columns(i).ColumnName)  
                            rgResult.MasterTableView.Columns.Add(Tempcol)  
 
                        ElseIf item.Value.ToLower = "totalattachments" Then 
                            'If CType(Session("Attachment"), Boolean) = True Then  
                            Dim Tempcol As New GridTemplateColumn  
 
                            'creates the template column for showing link   
                            Tempcol.ItemTemplate = New MyTemplate(dt.Columns(i).ColumnName, ProID, True, ShowMe)  
 
                            Tempcol.HeaderText = "Attachments" 'item.Text  'drow("DisplayName") 'GetDisplayName(dt.Columns(i).ColumnName)  
                            rgResult.MasterTableView.Columns.Add(Tempcol)  
                            'End If  
                        Else 
                            'removes all html tags from the data.  
                            For Each row As DataRow In dt.Rows  
                                row(i) = RemoveHTML(row(i).ToString)  
                                If row(i).ToString.Length > MaxLength Then 
                                    row(i) = row(i).ToString.Substring(0, MaxLength) & "..." 
                                End If 
                            Next 
 
                            'creates the column  
                            Dim column1 As New GridBoundColumn  
                            column1.DataField = dt.Columns(i).ColumnName  
                            column1.HeaderText = item.Text  
                            rgResult.MasterTableView.Columns.Add(column1)  
                        End If 
 
 
                        End If 
                Next 
            Next 
 
       Catch ex As Exception  
 
        End Try 
    End Sub 
 
 

The classes used for template column are

Public Class GridCheckboxTemplate  
    Implements ITemplate  
    Protected boolValue As CheckBox  
    Private colname As String 
    Private DatacolField As String 
 
    Public Sub New(ByVal cName As String)  
        colname = cName  
    End Sub 
    Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements ITemplate.InstantiateIn  
        boolValue = New CheckBox()  
        boolValue.ID = "CheckBox1" 
        boolValue.Enabled = True 
        boolValue.AutoPostBack = True 
        AddHandler boolValue.DataBinding, AddressOf boolValue_DataBinding  
        AddHandler boolValue.CheckedChanged, AddressOf CheckChanged  
        container.Controls.Add(boolValue)  
    End Sub 
    Sub boolValue_DataBinding(ByVal sender As Object, ByVal e As EventArgs)  
        Dim cBox As CheckBox = DirectCast(sender, CheckBox)  
        Dim container As GridDataItem = DirectCast(cBox.NamingContainer, GridDataItem)  
 
        cBox.ToolTip = (DirectCast(container.DataItem, DataRowView))(colname).ToString()  
         
    End Sub 
 
    Sub CheckChanged(ByVal sender As Object, ByVal e As System.EventArgs)  
      
   End Class 
Public Class MyTemplate  
    Inherits SearchResult  
    Implements ITemplate  
    Shared itemcount As Integer = 0  
    Private colname As String 
    Private ProjId As String 
    Private Trial_ID As String 
    Private PID As String = "" 
    Private ShowPage As String 
    Private ShowAttachment As Boolean 
    Protected lnkAttach As LinkButton  
    Protected lnkID As LinkButton  
 
 
        Public Sub New(ByVal cName As String, ByVal IDField As String, ByVal Attachment As Boolean, ByVal Show As String)  
        colname = cName  
        PID = IDField  
        ShowPage = Show  
        ShowAttachment = Attachment  
    End Sub 
 
      
       Sub InstantiateIn(ByVal container As Control) Implements ITemplate.InstantiateIn  
        'defines the link button  
 
        If ShowAttachment Then 
            lnkAttach = New LinkButton  
            lnkAttach.ID = "lnkAttach" 
            lnkAttach.ForeColor = Drawing.Color.Blue  
            AddHandler lnkAttach.DataBinding, AddressOf lnkAttach_DataBinding  
            lnkAttach.OnClientClick = "if (this.innerText == 'No Attachments'){return false;}else{ ShowAttachmentDetails(this.title);return false;}" ', " + lnkAttach.CommandName + " 
            container.Controls.Add(lnkAttach)  
        Else 
            lnkID = New LinkButton  
            lnkID.ID = "lnkAttach" 
            lnkID.ForeColor = Drawing.Color.Blue  
            AddHandler lnkID.DataBinding, AddressOf lnkID_DataBinding  
                       lnkID.OnClientClick = "Redirectwin(this.innerText, '" & ShowPage.ToLower.Trim & "'); return false;" 
                  container.Controls.Add(lnkID)  
        End If 
    End Sub 
 
    Sub lnkID_DataBinding(ByVal sender As Object, ByVal e As EventArgs)  
        Dim link As LinkButton = DirectCast(sender, LinkButton)  
        Dim container As GridDataItem = DirectCast(link.NamingContainer, GridDataItem)  
        link.Text = (DirectCast(container.DataItem, DataRowView))(colname).ToString()  
         
    End Sub 
 
 
     Sub lnkAttach_DataBinding(ByVal sender As Object, ByVal e As EventArgs)  
        Dim link As LinkButton = DirectCast(sender, LinkButton)  
        Dim container As GridDataItem = DirectCast(link.NamingContainer, GridDataItem)  
        link.Text = (DirectCast(container.DataItem, DataRowView))(colname).ToString()  
 
 
        GetDatatableID()  
 
        'checks if attachment is from project or trial  
        If Trial_ID = "0" Or Trial_ID Is Nothing Then 
            link.ToolTip = (DirectCast(container.DataItem, DataRowView))(ProjId).ToString() & "_" & "00" 
        Else 
            link.ToolTip = (DirectCast(container.DataItem, DataRowView))(ProjId).ToString() & "_" & (DirectCast(container.DataItem, DataRowView))(Trial_ID).ToString()  
        End If 
 
    End Sub 
 
     
    Private Sub GetDatatableID()     
        Try 
            Dim dt As New DataTable  
              Dim dtColumnList As New DataTable  
            Dim xmlDoc As New XmlDocument  
 
 
            Dim ds As New DataSet  
            Dim xmlReader As New XmlTextReader(Server.MapPath("~/XMLFiles_Search/IDFields.xml"))  
 
            ds.ReadXml(xmlReader)  
            xmlReader.Close()  
 
            dt = ds.Tables(0).Copy  
            For Each row As DataRow In dt.Rows  
                If row("Name") = ShowPage.ToLower.Trim Then 
                    ProjId = CType(row("ID"), String)  
                    Trial_ID = CType(row("TrialID"), String)  
                End If 
            Next 
 
        Catch ex As Exception  
 
        End Try 
 
 
    End Sub 
 
 
End Class 

But I am not able to maintain the radgrid structure if the checkbox is checked. As it I use Autopostback true then the grid refreshes and the checkbox column gets disappear. 
On a button click I have to remove all the unchecked rows from the grid.

Please can you suggest any way by which I can perform this function. 

Thanks and Regards,

Pinkey Yadav
   

 

 

Pavlina
Telerik team
 answered on 25 Feb 2010
1 answer
126 views
Hi,

I'm trying to make my app a bit more responsive so im looking into client side binding after ive added a row to the database.

I havent found any simple examples on here only partially complete complex examples. Can someone help me out with this questions - Should I be creating a webservice to retrieve information from or a webmethod (pagemethod?) or are these essentially the same thing?

Surely theres an example out there of adding information to a table and then refreshing the grid with client side binding? I'm addin the information through controls not the grid itself so i need to call a javascript method to refresh the grid.

Thanks,

Phil
Veli
Telerik team
 answered on 25 Feb 2010
7 answers
170 views
How can I set the background of a Dock to a semitransparent color ? 
i.e. - some alfa values to the color
 
Please help
Thanks in Advance
Arijit Chatterjee
HL
Top achievements
Rank 1
 answered on 25 Feb 2010
1 answer
194 views
I use RadEditor to edit text in a span (SPAN2) which has runat=server attribute by click on an ImageButton and load current text into RadEditor in a RadWindow and edited it. When I click submit button on RadWindow , the text display in this page is changed. But when I click Button1 to load edited text in SPAN2 into a literal (Literal1) , the Text displayed in Literal1 is not the text I edited but it display old text which declared in ASPX instead.

How to get the edited text to display in Literal1 ? I want to use edited text via code-behind.

this is my code ..

Main.aspx
<%@ Page language="c#" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
 
<script runat="server"> 
    protected void Button1_Click(object sender, EventArgs e) 
    { 
        Literal1.Text = SPAN2.InnerHtml; 
    } 
</script> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
        <title>Name</title> 
    </head> 
    <body> 
        <form id="Form1" method="post" runat="server"> 
        <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server"> 
            <Windows> 
                <telerik:RadWindow runat="server" ID="Editor" Width="700px" Height="550px" /> 
            </Windows> 
        </telerik:RadWindowManager> 
            <script type="text/javascript"> 
            var elementToEdit = null; 
            var oWnd = null;             
            function OpenWin(elemId) 
            { 
               elementToEdit = document.getElementById(elemId); 
               oWnd = radopen("Editor.aspx", "Editor"); 
            }        
            function WindowClose() 
            { 
               var oManager = GetRadWindowManager(); 
               var oWnd = oManager.GetWindowByName("Editor"); 
               oWnd.Close(); 
            }    
            </script> 
        <asp:UpdatePanel ID="UpdatePanel1" runat="server"> 
        <ContentTemplate> 
            <span id="SPAN2" runat="server" style="border:1px solid red;">Some sample text 1</span> 
            <asp:ImageButton ID="btnEdit2" runat="server" ImageAlign="AbsMiddle" ImageUrl="btn_textedit.png"  
            AlternateText="Edit" CausesValidation="false" OnClientClick="OpenWin('SPAN2'); return false;" /> 
        </ContentTemplate> 
        </asp:UpdatePanel>       
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /> 
        <br /> 
        <asp:Literal ID="Literal1" runat="server"></asp:Literal>         
        </form> 
    </body> 
</html> 

Editor.aspx

<%@ Page language="c#" %> 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
<html> 
    <head> 
        <title>Edit Text</title> 
    </head> 
    <body> 
        <form id="Form1" method="post" runat="server"> 
        <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
        <script type="text/javascript"> 
            function OnClientLoad (editor)           
            { 
                var oElement = window.parent.elementToEdit; 
                if (oElement) 
                {        
                    editor.set_html(oElement.innerHTML); 
                } 
                editor.add_submit(function () 
                { 
                    var oElement = window.parent.elementToEdit; 
                    if (oElement) 
                    {                    
                        oElement.innerHTML = editor.get_html(true); 
                    }                    
                    window.parent.WindowClose(); 
                    return false;        
                }); 
            } 
        </script> 
        <telerik:RadEditor ID="editor1" OnClientLoad="OnClientLoad" Runat="server"> 
        </telerik:RadEditor>   
        <input type="submit" value="Submit" /> 
        </form> 
    </body> 
</html> 
 

Thanks for your help.
Dobromir
Telerik team
 answered on 25 Feb 2010
7 answers
302 views
If a row is in edit mode and user clicks on the Update link, I would like to make changes to the database in the update event of the radgrid and then make the row uneditable till he double clicks again.  How do I do this on the server side?

I found this code to do this on the front end:

$find("<%= RadGridEmpData.MasterTableView.ClientID %>").cancelAll();

, but I need to do this on the server side after updates are done.

Thanks.

Suresh
Suresh Mishra
Top achievements
Rank 1
 answered on 25 Feb 2010
2 answers
54 views
I'm having an issue using the PageSize property in the NeedDataSource event of the grid (for use with custom paging to only get the necessary records per page) when the PageSize is set in an ASP.NET skin.  The PageSize property always seems to be 10 (default value) in the NeedDataSource event even though I have it set as 15 in the skin declaration, but when the grid is rendered the pager shows "items XX to XX" with the increments being 15 so this really throws off the paging since it's only actually displaying 10 per page. 
MD
Top achievements
Rank 1
 answered on 25 Feb 2010
1 answer
138 views
Hi All,
Basically, I want have the user click on a node in a treeview and have a new browser window open with the given url.
I know I can set the NavigateUrl to the url and Target='_blank', but I need to go a little further. I want to be able to have something like the link shown below. This way I can hide stuff I want to hide and size the new browser window.

<a href="javascript:void window.open('http://www.envisionaccounting.com',
  '_blank','resizable=1,toolbar=0,status=0,menu=0,top=20,left=20,width=1280,height=1024')"
 >
  Click here!
 </a>

Any help would be great!
Thanks ... Ed


Yana
Telerik team
 answered on 25 Feb 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?