Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
135 views
Hello everyone,

I am trying to write a javscript function that opens a rad window if the user selects a certain value from a rad combo box.
The event fires fine when the user changes a value in the combo box. The problem is that the javascript IF statement seems to be ignored.

 

 

 

 

 

The  radwindow opens even when the selected value is not 4...which I checked with document.write.

Im sure this is a school boy error - but I just cant see what the problem is...

function OnClientSelectedIndexChanged(sender, args)  
{  
   var item = args.get_item();  
   var selectedvalue = item.get_value();  
   //document.write("value is:" + selectedvalue);  
   if (selectedvalue="4")  
   {  
   window.radopen("csat.aspx","UserListDialog1");  
   return false;  
   }  
}  
 
 
 
des white
Top achievements
Rank 1
 answered on 25 Feb 2010
4 answers
138 views
I am having a problem setting the height of the scheduler control in FireFox (FF). IE displays correctly though.

As you can see in the screenshot the scroll button does not appear. I have read in other post that the scheduler height may need to be hard-coded...so I tried that and I couldn't get that to work.

If I perform an action on the scheduler; such as change the month; the scroll bars will appear correctly.


Notes:
The scheduler is in an asp:panel with the visible property set to false. When I check a checkbox I display the scheduler by setting the asp:panel to true

                            <tr class="fieldRow" id="rowRecurringDetails3" style="height:260px"
                                <td colspan="3" style="height:260px"
                                    <telerik:RadScheduler runat="server" ID="scheduler"  Skin="Myskin" EnableEmbeddedSkins="false" 
                                         SelectedDate="2010-02-16" DayStartTime="08:00:00" DayEndTime="18:00:00" Width="480px"  Height="260px"  OverflowBehavior=Scroll 
                                         TimeZoneOffset="03:00:00" SelectedView="MonthView" ShowHeader="true" ShowViewTabs="false" 
                                         ShowNavigationPane="true" ShowFooter="true" EnableRecurrenceSupport="true" EnableAdvancedForm=true DataRecurrenceField="4" DataRecurrenceParentKeyField="6"  
                                         OnAppointmentDelete="scheduler_AppointmentDelete" OnAppointmentInsert="scheduler_AppointmentInsert" OnAppointmentUpdate="scheduler_AppointmentUpdate" OnRecurrenceExceptionCreated="scheduler_RecurrenceExceptionCreated" 
                                         AllowInsert="false"
                                        <AdvancedForm Modal="true"   /> 
                                    </telerik:RadScheduler> 
                                </td> 
                                 
 
                                 
                                <td></td
                                <td></td
                                 
                                <!-- Example Column --> 
                                <td class="exampleColumn" > 
                                    <div class="exampleColumnContent"
                                        <div class="exampleColumnTextBox"
                                            Example 
                                        </div> 
                                    </div> 
                                </td> 
                                 
                            </tr> 

Any ideas on how to get the scroll bar to appear in FireFox?


Felipe

Felipe Saldana
Top achievements
Rank 1
 answered on 25 Feb 2010
2 answers
165 views
Hi,

I would like to bind Radcombo boxes in the grid from code-behind, because of the flexibility. 
I want the combo to be related to another combo in the grid, but first i have problems with setting the selected value of the combo. 

Here's a snippet of the grid columns:
                              <telerik:GridTemplateColumn UniqueName="CustomersTemplate" HeaderText="Kunde"
                                    <ItemTemplate> 
                                       <%#DataBinder.Eval(Container.DataItem, "CustID")%> 
                                    </ItemTemplate> 
                                    <EditItemTemplate> 
                                        <telerik:RadComboBox AutoPostBack="true" Width="200px" ID="CustomersDropDown" runat="server" 
                                                DataTextField="Company" DataValueField="CustID"  
                                                AppendDataBoundItems="True" Skin="GiveNH3_default" 
                                                ChangeTextOnKeyBoardNavigation="true" EnableLoadOnDemand="true" MarkFirstMatch="true" EnableEmbeddedSkins="false" 
                                                > 
                                                <Items> 
                                                    <telerik:RadComboBoxItem runat="server" Text=""  
                                                        Value="0" /> 
                                                </Items> 
                                        </telerik:RadComboBox> 
                                    </EditItemTemplate> 
                                </telerik:GridTemplateColumn> 

And of the code-behind:
Protected Sub Grid_ItemDataBound(ByVal sender As ObjectByVal e As GridItemEventArgs) Handles Grid.ItemDataBound 
  If (TypeOf e.Item Is GridEditableItem AndAlso CType(e.Item, GridEditableItem).IsInEditMode) Then 
Using C As RadComboBox = CType(item.FindControl("CustomersDropDown"), RadComboBox) 
                Dim dt As New DataTable 
        Dim _CustTypeID = 1 'This could be different for each combo, and would be set from another combo in the grid 
                Using cmd As New SqlCommand("SELECT * FROM Customers WHERE CustTypeID = " & _CustTypeID  & "", GetSQLConnection) 
                    Using dr = cmd.ExecuteReader 
                        dt.Load(dr) 
                    End Using 
                End Using 
                C.DataSource = dt 
                C.DataBind() 
                Dim editItem = CType(e.Item, GridEditableItem) 
 
                'This doesn't return the corret value from saved value in the database - instead it returns the first value of the datasource 
                Dim s = DataBinder.Eval(editItem.DataItem, "CustID").ToString 
                C.SelectedValue = s 
 
            End Using 
End if 
End sub 


Can you point me in the right direction? 

Any help appreciated!


( I use v. 2009.3.1314.35 of the web.ui)

KorsG
Top achievements
Rank 1
 answered on 25 Feb 2010
1 answer
160 views
Hi,
As long as I put my Web User Control into my page, RadToolBar on my page will not fire its ButtonClick event. Otherwise, it's working. Any idea?

Thanks,
Enoch

Enoch Kuang
Top achievements
Rank 1
 answered on 25 Feb 2010
4 answers
205 views
I am attempting to implement filtering for the first time using the RadGrid and have run into a problem/question/ignorance and I hope that someone can guide me in the correct direction.  Here is the scenario:

I have a page that loads a grid with filtering by column disabled (set to false).  The grid is using a LinqDataSource on the page and the DataSourceID is set.  The grid works fine for sorting, paging, etc.

The user may click on a button that turns on the filtering for the grid.  At this point the filtering is working great, including adding filters to multiple columns.  However, once a user chooses a non-filtering action that causes a postback, such as a sort or changing the page size, the filter disappears from the data.  The filter textboxes still show the values entered by the user, they are just not applied.

I have found that the FilterExpression on the MasterTableView object is an empty string, but the individual columns are retaining their CurrentFilterValue as the text entered into the filter textbox.

Do I need to manually "migrate" the filters from the columns up to the table level?  If so, at what point in the page/control's life cycle would be appropriate?

Thanks for any help and guidance that you can offer.

Adam


Mike Dennis
Top achievements
Rank 1
 answered on 25 Feb 2010
2 answers
135 views
Using your example for Performance with Web Services.  My app returns 8000+ items from the service and loads in < 10 seconds.  Yet the RCB appears empty after loading.  What am I mssing?

    function RequestingLoadofCombo(sender, eventArgs)  
    {  
        eventArgs.get_context()["DivID"] = RowDivID;  
        eventArgs.get_context()["Type"] = ContactType;  
    }  
    function Loaded()  
    {  
        alert("Loaded");  
    }  
 
 
                <telerik:RadComboBox ID="NonMembersComboBox" runat="server"   
                         Height="100px" Width="220px" ShowMoreResultsBox="true" MarkFirstMatch="true" 
                         EnableLoadOnDemand="True" OnClientItemsRequesting="RequestingLoadofCombo" 
                         OnClientItemsRequested="Loaded">  
                <WebServiceSettings Method="LoadCombo" Path="Admin.aspx" /> 
                 </telerik:RadComboBox> 
 
public class ComboBoxItemData  
{  
    private string text;  
 
        public string Text  
        {  
            get { return text; }  
            set { text = value; }  
        }  
    }  
 
    public static RadComboBoxData LoadCombo(RadComboBoxContext context)  
    {  
        int divID = (int)(context["DivID"]);  
        string typeString = (string)(context["Type"]);  
        char type = Convert.ToChar(typeString);  
        RadComboBoxData result = new RadComboBoxData();  
        List<RadComboBoxItemData> items = new List<RadComboBoxItemData>();  
        List<string> list = new List<string>();  
        Contacts c = new Contacts();  
        list = c.GetNonContacts(divID, type);  
        foreach (string id in list)  
        {  
            RadComboBoxItemData itemData = new RadComboBoxItemData();  
            itemData.Text = id;  
            items.Add(itemData);  
        }  
 
        result.Items = items.ToArray();  
        result.EndOfItems = true;  
 
        return result;  
    }  
 
 
 
 
 
Joel Brom
Top achievements
Rank 1
 answered on 25 Feb 2010
5 answers
141 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
55 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
141 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
261 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 ObjectByVal 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 ObjectByVal 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 StringByVal IDField As StringByVal Attachment As BooleanByVal 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 ObjectByVal 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 ObjectByVal 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?