Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
398 views

How i find in radcombobox in javascript tag ,

<telerik:RadCodeBlock runat="server" ID="radCodeBlock">
        <script type="text/javascript">
            function onSelectedIndexChanged(sender, eventArgs) {
                debugger;
                updateComboBox(sender);
            }

            function updateComboBox(listBox) {
                var text = "";
                var value = "";
                var items = listBox.get_selectedItems();

                for (var i = 0; i < items.length; i++) {
                    var item = items[i];

                    //Check whether the Item's 'selected' attribute is set to true.
                    if (item.get_selected()) {
                        text += item.get_text() + ", ";
                        value += item.get_value() + ", ";
                    }
                }

                text = text.substring(0, text.length - 2);
                value = value.substring(0, value.length - 2);

                var comboBox = $find("ComboBox_SortColumn");

                //Set the text of the RadComboBox to the texts of the selected Items, separated by ','.
                comboBox.set_text(text);

                //Set the value of the RadComboBox to values of the selected Items, separated by ','.
                comboBox.trackChanges();
                comboBox.get_items().getItem(0).set_value(value);
                comboBox.commitChanges();
            }

        </script>
    </telerik:RadCodeBlock>



<EditFormSettings CaptionFormatString="Create" EditFormType="Template">

  <td>
                                                                        <asp:Label ID="Label15" runat="server">Selected</asp:Label>
                                                                        <telerik:RadListBox runat="server" DataTextField="Text" DataValueField="Value" ID="RadListBoxDestinationGroup"
                                                                            AutoPostBackOnReorder="true" EnableDragAndDrop="true" AllowReorder="true" Height="140px"
                                                                            Width="160px" ButtonSettings-Position="Left" OnClientSelectedIndexChanged="onSelectedIndexChanged">
                                                                        </telerik:RadListBox>
                                                                    </td>

<td>
                                                        <telerik:RadComboBox ID="ComboBox_SortColumn" runat="server" Width="175px" SelectedValue='<%# Bind("SortColumn") %>'
                                                            AllowCustomText="true">
                                                            <Items>
                                                                <telerik:RadComboBoxItem Text="" />
                                                            </Items>
                                                        </telerik:RadComboBox>
                                                    </td>
<EditFormSettings/>



Thanks,
Mohamed.
Iana Tsolova
Telerik team
 answered on 06 Jun 2011
1 answer
127 views
Is it possible to output the following to a RadGrid rather than just the page?

Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
    Dim newPaswordSecureString As System.Security.SecureString = New System.Security.SecureString()
    Dim newPassword As String = "password"
    For Each c As Char In newPassword
        newPaswordSecureString.AppendChar(c)
    Next
    Dim credential As PSCredential
    credential = New PSCredential("userame", newPaswordSecureString)
    'Set the connection Info
    Dim connectionInfo As WSManConnectionInfo = New WSManConnectionInfo(New Uri("http://tusdcas1.tusd.local/powershell"), "http://schemas.microsoft.com/powershell/Microsoft.Exchange", credential)
    Dim runspace As Runspace = System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(connectionInfo)
    runspace.Open()
    Dim newMbx As Command
    newMbx = New Command("Get-MailboxStatistics")
    newMbx.Parameters.Add("Server", "TUSDMBSTORAGE1.tusd.local")
    Dim cmd As Pipeline = runspace.CreatePipeline()
    cmd.Commands.Add(newMbx)
    Dim commandResults As Collection(Of PSObject)
    commandResults = cmd.Invoke()
    For Each cmdlet As PSObject In commandResults
        Dim _cmdletDisplayName As String = cmdlet.Properties("DisplayName").Value.ToString()
        Dim _cmdletTotalItemSize As String = cmdlet.Properties("TotalItemSize").Value.ToString()
        Dim _cmdletLegacydn As String = cmdlet.Properties("LegacyDN").Value.ToString()
        Response.Write("Mailbox No.:" + _cmdletDisplayName + "," + _cmdletTotalItemSize + "," + _cmdletLegacydn)
    Next
End Sub

Thank you.
Hus Damen
Top achievements
Rank 1
 answered on 06 Jun 2011
1 answer
36 views
Is there a way to retain sort of grid across post backs & page redirections?

Thank you

Regards
Raj
Shinu
Top achievements
Rank 2
 answered on 06 Jun 2011
3 answers
151 views
Hi, 

    When i select a filter in the RadGrid send me an error here:

        Telerik.Web.UI.GridTableView.registerClass(

"Telerik.Web.UI.GridTableView",Sys.UI.Control);

 

        Telerik.Web.UI.GridFilterFunction=

function(){};

 

        Telerik.Web.UI.GridFilterFunction.prototype= {NoFilter:0,Contains:1,DoesNotContain:2,StartsWith:3,EndsWith:4,EqualTo:5,NotEqualTo:6,GreaterThan:7,LessThan:8,GreaterThanOrEqualTo:9,LessThanOrEqualTo:10,Between:11,NotBetween:12,IsEmpty:13,NotIsEmpty:14,IsNull:15,NotIsNull:16,Custom:17};

        Telerik.Web.UI.GridFilterFunction.registerEnum(

"Telerik.Web.UI.GridFilterFunction",false);

 

        Telerik.Web.UI.GridFilterFunction.parse=

function(b,a){return(typeof b=="number")?b:Sys$Enum$parse.call(this,b,!!a);

    Sys$Enum$parse is not defined

thank you for your help.

 

Iana Tsolova
Telerik team
 answered on 06 Jun 2011
1 answer
47 views
We are currently using an older version of RadGrid (4.0.1.0) in our application and I have noticed that the javascript being used access the MasterTableView is no longer working in FF4.0.1. It was working fine in FF3.5

The script in question looks the same as your samples:
function ShowEditForm(id, rowIndex) {
    var grid = window["<%= grd.ClientID %>"];
    var rowControl = grid.MasterTableView.Rows[rowIndex].Control;               
    grid.MasterTableView.SelectRow(rowControl, true);
    return ShowPopup("<%= GetUrl() %>" + id);
}

The same code works fine in IE8. In FF4, Firebug reports the variable 'grid' as Object { } and grid.MasterTableView is undefined. Under FF3.5, the variable 'grid' is listed as Object { Type="RadGrid" }

Any ideas how to fix this without upgrading the Rad controls?

Regards
Alan
Hus Damen
Top achievements
Rank 1
 answered on 06 Jun 2011
1 answer
173 views
I have a grid bound to a dynamic view. I am using the NeedDataSource and have the AutoGenerateColumns set to true because I never know what the column headers or count will be.

I have AllowFiltering set to true to allow users to work with the returned data. There are a couple of column settings I would like to apply to all columns and I am hoping to avoid writing a bunch of code in the PreRender event and then rebinding.

I would like to set the default filter (CurrentFilterFunction) to "StartsWith" and not "Contains" for all columns.
I would like to set the default FilterControlWidth to be the same width for all columns. I noticed that string columns are one size and numeric columns are another (larger?).

I've serched through the forums but can't find anything. If someone can provide a link or a suggestion that would be great.
 
Thanks,
Craig
Princy
Top achievements
Rank 2
 answered on 06 Jun 2011
1 answer
67 views
Hi,

I am having some issues when a grid is in edit/insert mode because the
web user control used to edit the data does not render properly.  The labels
of the form are not displayed (They are invisible) and when you type something
in the text boxes the characters are not displayed.

One additional thing is that a pop window is opened and inside the popup window
a user control is rendering a grid. That grid opens a popup window when it is 
in edit/insert mode. So, the escenario is a form, with a popup window that opens 
another popup window. 

The issue is happening only in Internet Explorer version 8.  Now most of the users
of the company are using this version.

we tested the form with Internet Explorer 9, Google Chrome (Latest version) and Firefox (Latest version) and it works fine.

I attached two screenshots. One shows the problem, and the other one renders fine.
(I.E 9, Google Chrome, Firefox).

The easiest way to fix it is to upgrade the I.Explorer, but for now what should be the
best way to fix it momentarily.

Regards,

Leonardo Vega.
Tsvetina
Telerik team
 answered on 06 Jun 2011
1 answer
569 views
I am writing Tooltip for RadGrid control columns, my following sample grid has Bound and Template columns. Following code working fine with Bound columns but not for Template column.

 <telerik:RadGrid ID="radCntDets" runat="server" GridLines="None" Width="938px"
                AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
                OnNeedDataSource="radCntDets_OnNeedDataSource"
                AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
                HorizontalAlign="NotSet"
                Font-Size="Small"
                OnItemDataBound="radCntDets_ItemDataBound"
                OnItemUpdated="radCntDets_ItemUpdated"
                 OnUpdateCommand="radCntDets_UpdateCommand"
                 OnInsertCommand="radCntDets_InsertCommand"
                 OnDeleteCommand="radCntDets_DeleteCommand">
                 <ClientSettings EnableRowHoverStyle="True">
                    <ClientEvents OnColumnClick="rowColumnClicked" OnRowClick="rowClick" OnCommand="oncommand" />
                    <Scrolling AllowScroll="true" UseStaticHeaders="True" />
                </ClientSettings>
                <MasterTableView  GridLines="None" CommandItemDisplay="Top" DataKeyNames="ControlID" EditMode="InPlace">
                    <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" ItemStyle-Width="100px" HeaderStyle-Width="100px">
                            <HeaderStyle Width="100px"></HeaderStyle>
                            <ItemStyle Width="100px"></ItemStyle>
                        </telerik:GridEditCommandColumn>
                        <telerik:GridButtonColumn ConfirmText="Delete this control?" ButtonType="ImageButton"
                            CommandName="Delete" Text="Delete" UniqueName="DeleteColumn1">
                            <HeaderStyle Width="20px" />
                            <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                        </telerik:GridButtonColumn>
                        <telerik:GridTemplateColumn HeaderText="Email Address" UniqueName="EmailAddress" ItemStyle-Width="80px" HeaderStyle-Width="80px">
                            <ItemTemplate>
                                <%#DataBinder.Eval(Container.DataItem, "EmailAddress")%>
                            </ItemTemplate>
                            <EditItemTemplate>
                                 <%--<asp:TextBox ID="txtEAddress" runat="server" Text='<%# Bind("EmailAddress") %>'></asp:TextBox>--%>
                                <input id="txtEmails" runat="server"  type="text" class="bodyText" width="120px" onchange="return ValidateEmail(this);" />
                                <asp:RegularExpressionValidator Display="Dynamic" ID="RegularExpressionValidator1" ValidationExpression="^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"
                                            runat="server" ControlToValidate="txtEmails" ErrorMessage="Valid E-mail address is required.">*</asp:RegularExpressionValidator>
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn UniqueName="Description" HeaderText="Description" DataField="Description"
                            HeaderStyle-Width="220px" ItemStyle-Width="220px">
                            <HeaderStyle Width="220px"></HeaderStyle>
                            <ItemStyle Width="220px"></ItemStyle>
                        </telerik:GridBoundColumn>
                      
                    </Columns>
         </MasterTableView>
         <FilterMenu EnableImageSprites="False"></FilterMenu>
         <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
        </telerik:RadGrid>

 protected void radCntDets_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem gridItem = e.Item as GridDataItem;
                foreach (GridColumn column in radCntDets.MasterTableView.RenderColumns)
                {
                    if (column is GridBoundColumn)
                        gridItem[column.UniqueName].ToolTip = gridItem[column.UniqueName].Text;

                    if (column is GridTemplateColumn)
                    {
                        // How to get ItemTemplate (EmailAddress) value
                    }
                }
            }
        }

Thanks in advance for your help.

- Indra

Princy
Top achievements
Rank 2
 answered on 06 Jun 2011
1 answer
84 views
Hey,

in a regular gridview I can easily get the number of the row which was selected.
dataGridView1.Rows[0].Selected = true;


somehow, I can't get it in a radGrid.

I tried:
string selectedValue = (RadGrid1.SelectedItems[0] as GridDataItem)["users"].Text;

but I keep getting excaption:
"Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index"

Can anyone point out this code?

Thx
Princy
Top achievements
Rank 2
 answered on 06 Jun 2011
5 answers
84 views

 I have a radgrid with a template to edit a pretty big record.

 I created the template, added a few fields, edited, saved all is well.

 Next I added a tabstrip to the template, created tabs for billing address, mailing address, etc…

Everything looks great but when I try to update the record the information in the tabstrip does not get saved. (None of the tabs)

 The few header fields outside of the tabstrip do update fine and no error is generated.

 I hope this makes sense.

 Thanks for any help.

 Bill

Paul
Top achievements
Rank 1
 answered on 06 Jun 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?