or

Please, note that the solutions above will not work for MOSS 2007 and MVC applications. To fix the problem:
<radG:RadGrid ID="CustomerGrid" runat="server" AutoGenerateColumns="false" Width="100%" EnableAJAX="True" OnPageIndexChanged="SearchResults_PageIndexChanged" Skin="Office2007" AllowFilteringByColumn="False" AllowPaging="True" PageSize="35" ShowStatusBar="True" ShowFooter="False" ShowGroupPanel="False" GridLines="None" CellPadding="1" AllowSorting="True" OnSortCommand="RadGrid1_SortCommand"> <PagerStyle Mode="NextPrevAndNumeric" /> <MasterTableView EditMode="InPlace" ShowFooter="True" Width="99%" TableLayout="Auto" AllowMultiColumnSorting="true" AllowNaturalSort="true"> <Columns> <radG:GridBoundColumn DataField="CustomerID" HeaderText="Customer Number" SortExpression="CustomerID" UniqueName="CustomerID"> </radG:GridBoundColumn> <radG:GridBoundColumn DataField="CustomerName" HeaderText="Customer Name" SortExpression="CustomerName" UniqueName="CustomerName"> </radG:GridBoundColumn> <radG:GridTemplateColumn HeaderText="Status" HeaderStyle-Width="160px" ItemStyle-Width="160px"> <ItemTemplate> <%# GetStatus(Eval("CustomerID")) %> </ItemTemplate> </radG:GridTemplateColumn> <radG:GridBoundColumn DataField="Effective" HeaderText="Effective"> </radG:GridBoundColumn> </Columns> <ExpandCollapseColumn Visible="False"> <HeaderStyle Width="19px" /> </ExpandCollapseColumn> <RowIndicatorColumn Visible="False"> <HeaderStyle Width="20px" /> </RowIndicatorColumn> </MasterTableView> <ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True"> <Scrolling AllowScroll="True" UseStaticHeaders="True"></Scrolling> </ClientSettings> </radG:RadGrid>protected void SearchResults_PageIndexChanged(object source, Telerik.WebControls.GridPageChangedEventArgs e) { LoadData(); } protected void RadGrid1_SortCommand(object source, Telerik.WebControls.GridSortCommandEventArgs e) { if (!e.Item.OwnerTableView.SortExpressions.ContainsExpression(e.SortExpression)) { GridSortExpression sortExpr = new GridSortExpression(); sortExpr.FieldName = e.SortExpression; sortExpr.SortOrder = GridSortOrder.Ascending; e.Item.OwnerTableView.SortExpressions.AddSortExpression(sortExpr); } }
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) NextEnd Sub