Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
100 views
Folks,

Environment: RadControls for ajax 2011 v1 with VStudio 2010. I am using below link as a prototype.

http://demos.telerik.com/aspnet-ajax/grid/examples/programming/detailtabledatabind/defaultcs.aspx

I know there is a Telerik tutorial to hide the (expand/collapse) if no child rows. But my intention is to hide the expand/collapse if no child rows or Customer name starts with 'AN' or 'BL' in GridDataitem.

Thanks

gc_0620
Jayesh Goyani
Top achievements
Rank 2
 answered on 12 May 2011
2 answers
67 views
Hello,

 I have a grid. In which one of the column header I have added image in ItemDataBound event.

I observed that the image is added next to text.

Is it possible to change the location of image within column header ?

Also I wish to have more control on the space and alignment of the image ? 
Shinu
Top achievements
Rank 2
 answered on 12 May 2011
4 answers
122 views
Hi,

   I am using RadGrid ,an d i have given ClientselectColumn for multiselect.
From the server side am using following code

string

 

script = string.Empty;

 

 

script = script +

"selected = new Array();";

 

 

 

foreach (int id in lstselectedIDS)

 

 

{

 

script = script +

"selected.push(\"" + id + "\");";

 

 

}

 

script +=

"SetSelectedRowCount();";

 

 

 

base.AddStartupScript(script);

from the client side am taking the elements in the selected array and making the selection in Rowcreated event  like this

 

 

function

 

Grid_RowCreated(sender, args) {

 

 

 

 

var _Id = args.getDataKeyValue(sender.get_masterTableView().get_name());

 

 

 

 

if (selected.contains(_Id)) {

 

 

args.get_gridDataItem().set_selected(

 

true);

 

 

}
}

Because of this when ever i click on Check box for deselecting it is happening correctly. But if i click again for selecting it it is not happening properly. I need click checkbox 2 times for making a selection.

This is happening only for the selected rows.

If i use server side selection in ItemdataBoud Event, am not getting this problem.
Like
e.Item.Selected=true;
But i need to use the former one

And also am facing this problem in  many screens,please help me by giving the solution as soon as possible.


Thanks,
John

john
Top achievements
Rank 1
 answered on 12 May 2011
5 answers
277 views
In the legacy TreeView, you could set the NavigateUrl and Target properties on a Node.  When used in conjunction with the RadSplitter, you could load content into a specific RadPane by using these settings on a Node  This appears to be broken in the just-released Q3 version.

For example, in this example, when you click on one of the TreeViewNodes, the entire page gets replaced by the NavigateURL setting.  You would expect that the content gets directed into the Content pane.

<

telerik:RadSplitter ID="RadSplitter1" runat="server" Orientation="Vertical" Width="700" Height="500">

<telerik:RadPane ID="Tree" runat="server" Width="30%">

<telerik:RadTreeView ID="RadTreeView1" runat="server">

<Nodes>

<telerik:RadTreeNode runat="server" Target="Content" Text="MSDN" NavigateUrl="http://msdn.microsoft.com"></telerik:RadTreeNode>

<telerik:RadTreeNode runat="server" NavigateUrl="http://www.google.com" Target="Content"

Text="Google">

</telerik:RadTreeNode>

</Nodes>

</telerik:RadTreeView>

</telerik:RadPane>

<telerik:RadSplitBar runat="server" />

<telerik:RadPane ID="Content" runat="server" ContentUrl="about:blank" Width="70%">

</telerik:RadPane>

</telerik:RadSplitter>

I'll open a case.

Mac P
Top achievements
Rank 1
 answered on 12 May 2011
1 answer
68 views
Hi

How can I format date in auto generated column? Can someone point me to the right direction?

Thanks In advance
Shabbir.
Gimmik
Top achievements
Rank 1
 answered on 12 May 2011
1 answer
112 views
I am building a custom content provider to allow FileExplorer to use RackSpace CloudFiles.  So far, I've been able to get it to list directories and contents flawlessly.  However, there seems to be an issue uploading and deleting files (objects).

In my provider class I have the required "DeleteFile" method (really you guys should have a Interface to implement, NOT a class to inherit) however the DeleteFile method is never called when deleting, same goes for the StoreFile method when uploading.

Instead I get the following error: The selected file could not be deleted because the application did not have enough permissions.  Please contact system administrator

I have checked and the Delete and Upload paths are set correctly, and ViewState is turned on as well, but no matter what I do, the FileExplorer never actually calls the Content Provider methods...

ISSUE SOLUTION:
The solution is pretty simple... I did not have an overriding method in my provider for "CheckDeletePermissions" method.  Unfortunately because these providers are setup to Inherit a base provider instead of Implementing an Interface there is nothing to "force" me as a programmer to implement all MANDATORY overrides... I guess it's a matter of preference but I enjoy using Interfaces, they do a great job of enforcing correct programming for providers.

At at any rate, I have implemented this override method and not instead of calling the base provider class for Deleting it's calling the customer provider on delete instead.  I will also assume that overriding "CheckWritePermissions" will also take care of my uploading issue.

Happy Coding, good luck to the rest of you.
Mitch
Top achievements
Rank 1
 answered on 11 May 2011
1 answer
213 views
I have a radGrid which displays a couple of GridBoundColumns representing decimal data fields in editmode as a Percentage = DataFormatString="{p:0}", but if I go to edit one of these and click update I generate the following error, since the other textbox is displaying with "  %"  in the value, ..

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Input string was not in a correct format.

How can I have my cake and eat it too? I want to Display percentages as whole numbers and edit them the same way?
grid is named rdAsset

 

 

<

 

telerik:GridBoundColumn DataField="Target" DataType="System.Decimal" DataFormatString="{0:p2}"  HeaderText="Target%" SortExpression="Target" UniqueName="Target">

 

 

 

</telerik:GridBoundColumn>

 

 

 

 

 

 

 

 

<telerik:GridBoundColumn DataField="TargetRange" DataType="System.Decimal" DataFormatString="{0:p2}"

 

 

 

HeaderText="Target Range%" SortExpression="TargetRange" UniqueName="TargetRange">

 

 

</telerik:GridBoundColumn>

 

 

 

 

In the code behind, I have...

 

 

 

protected void rdAsset_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)

 

 

{

 

 

if (e.Item is GridEditableItem && (e.Item as GridEditableItem).IsInEditMode )

 

 

{

 

 

GridEditFormItem item = e.Item as GridEditFormItem;

 

 

 

TextBox target = item["Target"].Controls[0] as TextBox;

 

 

target.Text =

String.Format("{0:p2}", (item.DataItem as DataRowView).Row["Target"]);

 

 

 

TextBox targetRange = item["TargetRange"].Controls[0] as TextBox;

 

 

targetRange.Text =

String.Format("{0:p2}", (item.DataItem as DataRowView).Row["TargetRange"]);

 

 

 

}

Gimmik
Top achievements
Rank 1
 answered on 11 May 2011
3 answers
225 views

I've seen a couple other posts about this, but none of them had an answer that actually worked. My problem is that I have a RadGrid inside of a RadMultiPage, and I'm using RadAjaxManager. Whenever I click to go to the next page, or change the page size, or anything of that nature, the RadGrid disappears. When looking at the source code the markup for the RadGrid does not appear, just a couple of div tags in its place. This is the code on my .aspx page:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CreateAccount.aspx.cs" Inherits="DADCA.Account.CreateAccount" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  
<head id="Head1" runat="server">
    <title>Dayton Defense - Login</title>
    <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        /*the following CSS rules take care of expanding the html, body and form elements
        in case the page content is shorter than the browser window viewport.*/
  
        html,
        body,
        form
        {
            min-height:100%; /*all except IE6*/
            margin:0;
            padding:0;
        }
  
        * html html,
        * html body,
        * html form
        {
            height:100%; /*IE6 only*/
        }
  
        .MyModalPanel
        {
            position:absolute;
        }
    </style>
</head>
<body style="background: #fff; ">
    <form id="page_form" runat="server">
    <div style="width:500px; margin: 20px auto 0px auto !important;">
        <telerik:RadScriptManager ID="LoginRadScriptManager" runat="server" />
        <telerik:RadAjaxManager ID="RadAjaxManager" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadSubmitButton">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="createAccountMultiPage" LoadingPanelID="win7LoadingPanel" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="companySearchResultsGrid">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="createAccountPanel" LoadingPanelID="win7LoadingPanel" />
                        <telerik:AjaxUpdatedControl ControlID="companySearchResultsGrid" />
                        <telerik:AjaxUpdatedControl ControlID="createAccountMultiPage" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="win7LoadingPanel" runat="server" CssClass="MyModalPanel" Skin="Windows7" IsSticky="true" Width="100%" Height="100%" />
        <telerik:RadMultiPage ID="createAccountMultiPage" runat="server" Width="100%">
            <telerik:RadPageView ID="companySearchView" runat="server" Selected="true">
                <table width="100%" align="center">
                    <tr>
                        <td> </td>
                    </tr>
                    <tr>
                        <td width="40%" align="left">
                            <img src="../Images/DaytonDefenseLogo.jpg" alt="Dayton Defense Logo" width="100%"/>
                        </td>
                        <td width="5%"></td>
                        <td align="left" valign="top" width="55%">
                            <h1>Register</h1>
                        </td>
                    </tr>
                    <tr><td> </td></tr>
                </table>
                <table width="100%" align="center">
                    <tr>
                        <td colspan="3" align="center">
                            Please enter your company's name in the textbox below and click "Submit".<br /><br />
                            This will search our database to see if a record of your company already exists. 
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3" align="center">
                            <span class="failureNotification">
                                <span style="color: Red">
                                    <asp:Label ID="errorLabel" runat="server" Visible="false" />
                                </span>
                            </span>
                        </td>
                    </tr>
                    <tr><td> </td></tr>
                    <tr>
                        <td width="48%" align="right">
                            <span id="asterikSpan" style="color:Red;" runat="server" visible="false">*</span>Company Name: 
                        </td>
                        <td width="2%"> </td>
                        <td align="left">
                            <telerik:RadTextBox ID="companyName" runat="server" Skin="Windows7" />
                        </td>
                    </tr>
                    <tr><td> </td></tr>
                    <tr>
                        <td colspan="3" align="center">
                            <telerik:RadButton ID="RadSubmitButton" runat="server" OnClick="RadSubmitButton_OnClick" Text="Submit"  Skin="Windows7" Width="150px" ValidationGroup="LoginUserValidationGroup" />
                        </td>
                    </tr>
                </table>
            </telerik:RadPageView>
            <telerik:RadPageView ID="companySearchResultsView" runat="server">
                <table width="100%" align="center">
                    <tr>
                        <td> </td>
                    </tr>
                    <tr>
                        <td width="40%" align="left">
                            <img src="../Images/DaytonDefenseLogo.jpg" alt="Dayton Defense Logo" width="100%"/>
                        </td>
                        <td width="5%"></td>
                        <td align="left" valign="top">
                            <h1>Register</h1>
                        </td>
                    </tr>
                    <tr><td> </td></tr>
                </table>
                <table width="95%" align="center">
                    <tr>
                        <td colspan="3" align="right" width="100%">
                            <telerik:RadButton ID="backToSearchButton" runat="server" Text="Back To Company Search" Skin="Windows7" OnClick="backToSearchButton_OnClick" />
                        </td>
                    </tr>
                    <tr><td> </td></tr>
                    <tr>
                        <td colspan="3" align="center" width="100%">
                            Below are the results of your search.
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3" align="center">
                            If you see your company listed, click on the check mark to view details about your company and how to create your user account.
                        </td>
                    </tr>
                    <tr><td> </td></tr>
                    <tr>
                        <td colspan="3">
                            <telerik:RadGrid ID="companySearchResultsGrid" runat="server" AllowFilteringByColumn="True" AllowSorting="True" GridLines="None" 
                                                AllowPaging="True" Skin="Windows7" PageSize="20" OnSelectedIndexChanged="companySearchResultsGrid_SelectedIndexChanged" AutoGenerateColumns="False">
                                <MasterTableView DataKeyNames="id" Width="100%">
                                <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
  
                                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                                    <HeaderStyle Width="20px"></HeaderStyle>
                                </RowIndicatorColumn>
  
                                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                                    <HeaderStyle Width="20px"></HeaderStyle>
                                </ExpandCollapseColumn>
  
                                <Columns>
                                    <telerik:GridButtonColumn CommandName="Select" ButtonType="ImageButton" ImageUrl="~/Images/action_check.png" HeaderStyle-Width="8px" ItemStyle-Width="8px"/>
                                    <telerik:GridBoundColumn DataField="name" FilterControlAltText="Filter By Company Name" HeaderText="Company Name" SortExpression="name" UniqueName="name">
                                    </telerik:GridBoundColumn>
                                </Columns>
                            </MasterTableView>
  
                            <FilterMenu EnableImageSprites="False"></FilterMenu>
  
                            <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
  
                            </telerik:RadGrid>
                            <asp:SqlDataSource ID="companySearchResultsDS" runat="server" ConnectionString="<%$ ConnectionStrings:DADCAConnectionString %>" />
                        </td>
                    </tr>
                    <tr><td> </td></tr>
                    <tr>
                        <td colspan="3" align="left">
                            Don't see your company? <a href="#">Click here</a> to continue registration for a new company.
                        </td>
                    </tr>
                    <tr><td> </td></tr>
                </table>
            </telerik:RadPageView>
            <telerik:RadPageView ID="companyDetailsView" runat="server">
                <table width="100%" align="center">
                    <tr>
                        <td> </td>
                    </tr>
                    <tr>
                        <td width="40%" align="left">
                            <img src="../Images/DaytonDefenseLogo.jpg" alt="Dayton Defense Logo" width="100%"/>
                        </td>
                        <td width="5%"></td>
                        <td align="left" valign="top">
                            <h1><asp:Label ID="results_company_header_label" runat="server"></asp:Label></h1>
                        </td>
                    </tr>
                    <tr><td> </td></tr>
                </table>
                <table width="95%" align="center">
                    <tr>
                        <td colspan="3" align="right" width="100%">
                            <telerik:RadButton ID="backToSearchResults" runat="server" Text="Back To Company Search Results" Skin="Windows7" OnClick="backToSearchResultsButton_OnClick" />
                        </td>
                    </tr>
                    <tr><td> </td></tr>
                    <tr>
                        <td colspan="3" align="center" width="100%">
                            We currently have a record of your company in our database.<br /><br />
                            The point of contact (POC) for your company is:
                        </td>
                    </tr>
                    <tr><td> </td></tr>
                    <tr>
                        <td colspan="3" align="center">
                            POC details
                        </td>
                    </tr>
                    <tr><td> </td></tr>
                    <tr>
                        <td colspan="3">
                                  
                        </td>
                    </tr>
                    <tr><td> </td></tr>
                    <tr>
                        <td colspan="3" align="left">
                                  
                        </td>
                    </tr>
                </table>
            </telerik:RadPageView>
        </telerik:RadMultiPage>
        <script language="javascript" type="text/javascript">
  
            function GetRadWindow() {
                var oWindow = null;
                if (window.radWindow) oWindow = window.radWindow;
                else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
                return oWindow;
            }
  
            function CancelWindow() {
                var wnd = GetRadWindow();
                wnd.close();
            }
  
            function CloseWndw() {
                var wnd = GetRadWindow();
                wnd.close();
            }
  
            function Waiting(s, e) {
                Callback.PerformCallback();
                LPWaitConn.Show();
            }
  
            function RequestStart(sender, args) {
                if ($telerik.isSafari) {
                    var scrollTopOffset = document.body.scrollTop;
                    var scrollLeftOffset = document.body.scrollLeft;
                }
                else {
                    var scrollTopOffset = document.documentElement.scrollTop;
                    var scrollLeftOffset = document.documentElement.scrollLeft;
                }
  
                var loadingImageWidth = 55;
                var loadingImageHeight = 55;
  
                loadingPanel.style.backgroundPosition = (parseInt(scrollLeftOffset) + parseInt(viewportWidth / 2) - parseInt(loadingImageWidth / 2)) + "px " + (parseInt(scrollTopOffset) + parseInt(viewportHeight / 2) - parseInt(loadingImageHeight / 2)) + "px";
            }
        </script>
        <asp:Label ID="successLabel" runat="server" />
    </div>
    </form>
</body>
</html>

And this is my code-behind file:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using DADCA.Authentication;
  
namespace DADCA.Account
{
    public partial class CreateAccount : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {
                companySearchResultsGrid.DataSource = companySearchResultsDS;
                companySearchResultsGrid.DataBind();
            }
        }
  
        protected void RadSubmitButton_OnClick(object sender, EventArgs e)
        {
            if (companyName.Text != null && companyName.Text != "")
            {
                //Get the parameters for the query based on the company name the user gave us
                List<string> parameters = companyName.Text.Split(' ').ToList<string>();
  
                if (parameters != null && parameters.Count > 0)
                {
                    //Set the SQL query of the data source
                    string sql = "SELECT [Companies].id, [Companies].name FROM Companies WHERE ";
  
                    foreach (string p in parameters)
                    {
                        sql += "[Companies].name LIKE '%" + p + "%' OR ";
                    }
  
                    sql = sql.Substring(0, sql.Length - 4); //Trim off the last ' OR '
  
                    //Set the select command of the data source
                    companySearchResultsDS.SelectCommand = sql;
  
                    //Assign the data source and rebind
                    companySearchResultsGrid.DataSource = companySearchResultsDS;
                    companySearchResultsGrid.DataBind();
  
                    //Change to the correct page view
                    companySearchResultsView.Selected = true;
  
                    //Get rid of any errors that may be there
                    errorLabel.Visible = false;
                    asterikSpan.Visible = false;
                }
            }
            else
            {
                errorLabel.Text = "You must supply your company name to continue.";
                errorLabel.Visible = true;
                asterikSpan.Visible = true;
            }
        }
  
        protected void companySearchResultsGrid_SelectedIndexChanged(object sender, EventArgs e)
        {
            var selectedCompany = companySearchResultsGrid.SelectedItems[0] as GridDataItem;
            if (selectedCompany != null)
            {
                string key = selectedCompany.GetDataKeyValue("id").ToString();
  
                //Once we have the ID of the company the user selected, show them the company's details
                //along with information on how to get added as a user
                  
            }
        }
  
        protected void backToSearchButton_OnClick(object sender, EventArgs e)
        {
            //Make sure we aren't showing any errors when we go back
            errorLabel.Visible = false;
            asterikSpan.Visible = false;
            companySearchView.Selected = true;
        }
  
        protected void backToSearchResultsButton_OnClick(object sender, EventArgs e)
        {
  
        }
  
    }
}

I have absolutely no idea what I'm doing wrong. I tried to rebind the grid in the page load method, but still no dice. Any ideas?
Andrew
Top achievements
Rank 1
 answered on 11 May 2011
2 answers
146 views

 Hi Everyone,

Problem Statement:  Inside of an ASP DetailsView, I have declared a RadEditor.   The content is bound inline with the content property.   When the field is empty, I need to display a stylized (greyed out or whatever..)  set of template text.   This is to help the users properly fill in the field.   I can't seem to figure out the best way to accomplish this.  

Tried so far:   Bind the content inline, and also put the template text in the content tags within the control declaration.  

Is there something I can do in the DetailsView databind to check the contents then post the template text?  

Here is the way I am binding this now:

<asp:TemplateField HeaderText="Summary" SortExpression="Summary">
                                <EditItemTemplate>
                                    <telerik:RadEditor ID="reSummary" runat="server" Height="80" Width="500" ToolsFile="xml\RadEditorToolbars.xml"
                                        Content='<%# Bind("Summary") %>'>
                                        <CssFiles>
                                            <telerik:EditorCssFile Value="Styles/EditorContentArea.css" />
                                        </CssFiles>
                                    </telerik:RadEditor>
                                    <br />
                                    <br />
                                    <br />
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("Summary") %>'></asp:TextBox>
                                </InsertItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("Summary") %>'></asp:Label>
                                </ItemTemplate>
                                <ControlStyle Width="600px" />
                                <HeaderStyle HorizontalAlign="Right" VerticalAlign="Top" Width="600px" />
                            </asp:TemplateField>


Thanks,
Daniel
Daniel
Top achievements
Rank 1
 answered on 11 May 2011
2 answers
97 views
Hi,

i do have an issue with the webparts delivered by by the SAK. I did a fresh install on our SP Farm (2 Servers with 2010 as Frontend) and everythings seems to work fine.
I activated the features on farm and collection level and were able to put the webparts on a page.
i added a list as shown in your video, but no list is visible.
After this i tried to add the SP List by Designer and this did the job.

Best regards

Chris
Christof
Top achievements
Rank 1
 answered on 11 May 2011
Narrow your results
Selected tags
Tags
+124 more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?