Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
183 views
Hi,
i am facing following problem with RadGrid if i am using ClientEvents-OnCommand.
the problem is if i am adding ClientEvents-OnCommand in radgrid, it does fire itemcomamnd event of grid for user defined command,
but it always points to the first item in radgrid (e.Item) .


 .ascx

       <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

            <script type="text/javascript">

                    function OnCommand(sender, args) {
                    // it is doing nothing
                }

            </script>

        </telerik:RadCodeBlock>



.cs

    protected void Page_Load(object sender, EventArgs e)
    {
        this.RadGrid1.ItemCommand += OnItemCommand;
        this.RadGrid1.ClientSettings.ClientEvents.OnCommand = "OnCommand";
    }

    void OnItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
    {
        if (e.Item == null)
            return;

        switch (e.CommandName)
        {
            // user defined
            case "Standard":

                 GridDataItem item = (GridDataItem)e.Item;

                // e.g  id is always Id of the first item in radgrid if ClientEvents-OnCommand is defined
                var id = new Guid(item["Id"].Text);
... etc


if i remove ClientEvents-OnCommand, it works fine.


am i doing anything wrong ?
Princy
Top achievements
Rank 2
 answered on 03 Feb 2011
3 answers
87 views
So I have a Grid with a header that is multiple lined.  I allow my user to sort the grid on any of the columns.  When they click the column header to perform said sort, the column header get odd looking.  I don't know how to exactly describe it so I have attached screen shots of the header when the grid 1st comes up and one after sorting.  I have also included my grid source code.
<telerik:RadGrid ID="rgResults" runat="server" Width="98%"
    DataSourceID="sqlResults" AllowPaging="True" GridLines="Both"
    AllowSorting="True" AutoGenerateColumns="False" BackColor="WhiteSmoke" 
    HorizontalAlign="Left" Font-Names="Verdana" Font-Size="10px" 
    Skin="Windows7" Height="500px">
    <ClientSettings AllowDragToGroup="False">
        <Scrolling AllowScroll="True" UseStaticHeaders="True" FrozenColumnsCount="4" /> 
        <Selecting AllowRowSelect="True" />
        <Resizing AllowColumnResize="True" AllowResizeToFit="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True" />                            
    </ClientSettings>
    <AlternatingItemStyle Font-Names="Verdana" Font-Size="9px" 
        BackColor="#CCFFCC" VerticalAlign="Top" />
    <HeaderStyle Font-Bold="True" HorizontalAlign="Center" BackColor="#3366CC" 
        ForeColor="White" Wrap="False" Height="35px" />
    <ItemStyle Font-Names="Verdana" Font-Size="9px" BackColor="WhiteSmoke" VerticalAlign="Top" />
    <MasterTableView AllowMultiColumnSorting="True" GridLines="Both">
        <CommandItemSettings ExportToPdfText="Export to Pdf" />
        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
            <HeaderStyle Width="20px" />
        </RowIndicatorColumn>
        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
            <HeaderStyle Width="20px" />
        </ExpandCollapseColumn>
        <Columns>
            <telerik:GridBoundColumn DataField="act_tick_id" 
                FilterControlAltText="Filter column column" UniqueName="ID" Visible="False">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Target_DT" 
                FilterControlAltText="Filter column column"  HeaderStyle-Width="88px"
                HeaderText="Target Close<br />Date & Time" UniqueName="TargDT" DataType="System.DateTime"  DataFormatString="{0:MM/dd/yyyy hh:mm tt}">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="priority_code" 
                FilterControlAltText="Filter Priority column" HeaderText="Priority" 
                UniqueName="Priority"  HeaderStyle-Width="55px">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="act_step_ticket_num" 
                FilterControlAltText="Filter column column" HeaderText="Ticket #" 
                UniqueName="Ticketnum" AutoPostBackOnFilter="True">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="acct_number" 
                FilterControlAltText="Filter column column" HeaderText="Account #" 
                UniqueName="AcctNum">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="line_num" 
                FilterControlAltText="Filter column column" HeaderText="Line #" 
                UniqueName="LineNum">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="act_step_open_csr" 
                FilterControlAltText="Filter column column" HeaderText="Open By" 
                UniqueName="OpenBy">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="user_group_code" 
                FilterControlAltText="Filter column column" HeaderText="Current<br />Group" 
                UniqueName="CurrGrp">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="user_first" 
                FilterControlAltText="Filter column column" HeaderText="Member" 
                UniqueName="Member">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="act_code" 
                FilterControlAltText="Filter column column" HeaderText="Action<br />Code" 
                UniqueName="ActCode">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="status_desc" 
                FilterControlAltText="Filter column column" HeaderText="Status" 
                UniqueName="Status">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Open_DT" 
                FilterControlAltText="Filter column column" HeaderText="Open<br />Date & Time" 
                UniqueName="Open_DT"  HeaderStyle-Width="88px">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Phase_DT" 
                FilterControlAltText="Filter column column" HeaderText="Phase<br />Date & Time" 
                UniqueName="Phase_DT"  HeaderStyle-Width="88px">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Close_DT" 
                FilterControlAltText="Filter column column" HeaderText="Actual Close<br />Date & Time" 
                UniqueName="Close_DT"  HeaderStyle-Width="88px">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="act_overall_due_status" 
                FilterControlAltText="Filter column column" HeaderText="Close<br />Status" 
                UniqueName="CloseStat">
            </telerik:GridBoundColumn>
        </Columns>
        <EditFormSettings>
            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
            </EditColumn>
        </EditFormSettings>
    </MasterTableView>
    <FilterMenu EnableImageSprites="False">
    </FilterMenu>
    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
    </HeaderContextMenu>
</telerik:RadGrid>
I am using the latest versoin of the software and I am observing this anomally in IE8.
Pavlina
Telerik team
 answered on 03 Feb 2011
5 answers
152 views
Is it possible to transfer items to\from a listbox to\from other types of controls? Or is it exclusive feature for listboxes? I'd really like to transfer items from a radgrid to a listbox.
Thanks.
Genady Sergeev
Telerik team
 answered on 03 Feb 2011
5 answers
140 views
Hi,

I am using jQuery to prepopulate a number of fields on a new item form, with one of the fields utilising the RadEditor. I can populate the field fine, but would like to add line breaks and unsure if and how to do so. So basically I want to be able to pass in a string to the RadEditor and including some basic formatting (tabs, new lines etc)

"This is what I have now: Add description here"
 -------------------------------------
"This is wat I would like:

Add description here"


How can I achieve this?

Thanks

David
Stanimir
Telerik team
 answered on 03 Feb 2011
3 answers
247 views
Hi,
is it possible to load a usercontrol client-side to show as tooltip?

I have problems with using the manager.targetcontrols.add... it feels like random, sometimes the tooltip shows up sometimes it doesn't.
So I want to try load the tooltip client-side instead.
I checked out some examples with client-side code:
    function showToolTip(element, id) { 
        var tooltipManager = $find("<%= radToolTipManager.ClientID %>"); 
 
        //If the user hovers the image before the page has loaded, there is no manager created 
        if (!tooltipManager) return; 
 
        //Find the tooltip for this element if it has been created 
        var tooltip = tooltipManager.getToolTipByElement(element); 
 
        //Create a tooltip if no tooltip exists for such element 
        if (!tooltip) { 
            tooltip = tooltipManager.createToolTip(element); 
 
            //Use the fact that the image was named after a country 
            //Extract the country name from the image, and set it as the value to be supplied to the web-service 
            //var src = element.getAttribute("src", 2); 
            //var country = src.substring (src.lastIndexOf("/") + 1, src.lastIndexOf(".")); 
            alert(id);
            tooltip.set_value(id); 
        } 
 
        tooltip.show(); 
    } 

<telerik:RadToolTipManager ID="radToolTipManager" runat="server" Position="BottomRight" Animation="None" AutoTooltipify="false"  
    Skin="Hay" EnableEmbeddedSkins="false" EnableEmbeddedBaseStylesheet="false" AutoCloseDelay="0" ShowDelay="100" CssClass="tooltip"  
    Width="300" Height="200" OffsetX="10" OffsetY="10"> 
    <WebServiceSettings Method="GetToolTip" Path="/usercontrols/Tooltip.ascx" /> 
</telerik:RadToolTipManager> 


So far so good, the id is the correct one when I hoover.

Just for fun I tried to set the usercontrol in the managers webservicesettings but when running I get:
The server method 'GetToolTip' failed.

Can this work or do I have to use targetcontrols.add...?

Thanks!

/Mattias

Svetlina Anati
Telerik team
 answered on 03 Feb 2011
3 answers
159 views
Hello,
 i'm implementing the Tooltipified RadGrid on my sharepoint site. I've followed all the instructions on the demo.
Upon mouseover on my radgrid, my tool tip pops-up but it's empty(no content).

I'm using this example: http://demos.telerik.com/aspnet-ajax/tooltip/examples/targetcontrolsandajax/defaultcs.aspx

when I step through the code,  the user control for the tooltip is present and I can view the text attribute of the control.
 
 I also stripped down the user control  page to a bare minimum to  just one label control but I had no success.
 At this point I don't know what's  causing the tool tip to be blank. 
  
 After a few mouseovers on the radgrid items, I get the following error:
-------------
Windows Internet Explorer

Stop running this script?

A script on this page is causing Internet Explorer to run slowly.
If it continues to run, your computer might become
unresponsive.
-----------


ASPX CODE:
<%@ Register Src="ActivityDetails.ascx" TagName="ActivityDetails" TagPrefix="actDetails" %>
 
 <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
    </telerik:RadAjaxLoadingPanel>
     
   <telerik:RadToolTipManager ID="RadToolTipManager1" OffsetY="-1" HideEvent="ManualClose"
        Width="250" Height="350" runat="server" EnableShadow="true" OnAjaxUpdate="OnAjaxUpdate" RelativeTo="Element"
        Position="MiddleRight">
    </telerik:RadToolTipManager>
 
   <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="rgCampaigns">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rgCampaigns" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="RadToolTipManager1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>



C# Code:
protected void OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args)
        {
            this.UpdateToolTip(args.Value, args.UpdatePanel);
        }
        private void UpdateToolTip(string ActivityCode, UpdatePanel panel)
        {
            Control ctrl = Page.LoadControl("/_controltemplates/WP_Campaigns/ActivityDetails.ascx");
            panel.ContentTemplateContainer.Controls.Add(ctrl);
                         
            ActivityDetails details = (ActivityDetails)ctrl;
            details.ActivityCode = ActivityCode;
          
        }
 
protected void rgCampaigns_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
         
                        if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
                        {
                            Control target = e.Item.FindControl("lblTitle");
                            if (!Object.Equals(target, null))
                            {
                                if (!Object.Equals(this.RadToolTipManager1, null))
                                {
                                    //Add the button (target) id to the tooltip manager
                                    this.RadToolTipManager1.TargetControls.Add(target.ClientID, (e.Item as GridDataItem).GetDataKeyValue("GlobalCode").ToString(), true);
 
                                }
                            }
                        }
 
                    
        }
reciated:

USER Control ASPX page:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ActivityDetails.ascx.cs"
    Inherits="Cosmos3.WebPages.ActivityDetails, Cosmos3.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5f15fbcafb2bcb72" %>
<asp:Label ID="lbltest" runat="server" Text="Label"></asp:Label>


USER Control C# page:
namespace Cosmos3.WebPages
{
    public partial class ActivityDetails : System.Web.UI.UserControl
    {
 
        public string ActivityCode
        {
            get
            {
                if (ViewState["ActivityCode"] == null)
                {
                    return "";
                }
                return (string)ViewState["ActivityCode"];
            }
            set
            {
 
                ViewState["ActivityCode"] = value;
 
            }
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
 
            lbltest.Text += "<br>Activity code: "+ActivityCode;
            
        }
    }
}


your help is highly appreciated.
Thank you.
-roland




Svetlina Anati
Telerik team
 answered on 03 Feb 2011
1 answer
118 views
hi
it dont know MyCustomFilteringColumnCS
how can i MyCustomFilteringColumnCS  be green
it black in my code
thanks
Daniel
Telerik team
 answered on 03 Feb 2011
9 answers
93 views
Good day!
I have got a grid with my custom skin made in the Visual Style Builder.
My custom skin css is here - http://new.globalfarm.ru/FarmPortal/Grid.FarmPortal.css
No matter what i write in ItemStyle Width &  HeaderStyle Width - columns look like they wants by themselfs in different browsers :(
HeaderStyle width is not equal with ItemStyle Width!
for example there are attached images for such code in different browsers (it no matter if i write only HeaderStyle Width or both ItemStyle Width &  HeaderStyle Width)

<telerik:RadGrid ID="grProducts" runat="server" CssClass="MyGridClass1"
        AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
        GridLines="None" Skin="FarmPortal" EnableEmbeddedSkins="false"
        onitemdatabound="grProducts_ItemDataBound" onprerender="grProducts_PreRender" Width="100%">
<MasterTableView Width="100%" TableLayout="Auto">
    <Columns>
        <telerik:GridBoundColumn DataField="Id" HeaderText="Id" ReadOnly="True" UniqueName="Id" SortExpression="Id" Visible="false">
            <HeaderStyle Width="0" />           
            <ItemStyle  HorizontalAlign="Left" Width="0" />
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Num" HeaderText="№" ReadOnly="True" UniqueName="Num" SortExpression="Num" HeaderStyle-Width="3%" ItemStyle-Width="3%" >
            <HeaderStyle Width="3%" />  
             <ItemStyle Width="3%" />
        </telerik:GridBoundColumn>
        <telerik:GridHyperLinkColumn DataNavigateUrlFields="Name" DataTextField ="Name" HeaderText="Наименование" UniqueName="Name" SortExpression="Name" HeaderStyle-Width="65%" ItemStyle-Width="65%">            
            <ItemStyle   Width="65%"  />
            <HeaderStyle Width="65%" />
        </telerik:GridHyperLinkColumn>
        <telerik:GridBoundColumn DataField="Count" HeaderText="Количество предложений" ReadOnly="True" UniqueName="Count" SortExpression="Count" HeaderStyle-Width="12%" ItemStyle-Width="12%" >           
            <ItemStyle  HorizontalAlign="Center" Width="12%"  />
            <HeaderStyle Width="12%" />
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="MinPrice" HeaderText="Мин. цена" ReadOnly="True" UniqueName="MinPrice" SortExpression="MinPrice" DataFormatString="{0:c2}" HeaderStyle-Width="10%" ItemStyle-Width="10%" >
            <HeaderStyle Width="10%" />
            <ItemStyle  HorizontalAlign="Center" Width="10%"  />
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="MaxPrice" HeaderText="Макс. цена" ReadOnly="True" UniqueName="MaxPrice" SortExpression="MaxPrice" DataFormatString="{0:c2}" HeaderStyle-Width="10%" ItemStyle-Width="10%" >
            <HeaderStyle Width="10%"  />
            <ItemStyle  HorizontalAlign="Center" Width="10%" />
        </telerik:GridBoundColumn>
    </Columns>
</MasterTableView>
    <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True"
        ReorderColumnsOnClient="True">
        <Selecting AllowRowSelect="True" />
        <Scrolling AllowScroll="True" UseStaticHeaders="True" />
    </ClientSettings>
</telerik:RadGrid>

there width i not equal, in the example in is not very aufull, but in other tables is. I want them to have equal width. What do I do wrong?
Pavlina
Telerik team
 answered on 03 Feb 2011
1 answer
123 views
I have gone through many forum posts regarding this and made sure that my web.config has the correct settings for telerik.web.ui.webresource.axd. Following is from my web.config. I pasted full content of system.webserver in case there is anything else conflicting with the telerik.

I get $telerik not found error on the browser side. Also, if I try the http://myserver.url/telerik.web.ui.webresource.axd - then I get 404 error. And I see that IIS maps it to StaticHandler and not the telerik handler. As following I see that the Handler entry is correct.

So, what is wrong? Please help.

----------------------------------------------------------------
 <system.webServer>
  <validation validateIntegratedModeConfiguration="false" />
  <modules>
   <remove name="ScriptModule" />
   <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  </modules>
  <handlers>
   <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
   <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
   <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
   <add name="Telerik.Web.UI.WebResource" path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" preCondition="integratedMode,runtimeVersion2.0" />
   <add name="Telerik.Web.UI.DialogHandler" path="Telerik.Web.UI.DialogHandler.aspx" verb="*" type="Telerik.Web.UI.DialogHandler, Telerik.Web.UI" preCondition="integratedMode,runtimeVersion2.0" />
  </handlers>
        <staticContent>
            <mimeMap fileExtension=".axd" mimeType="application/octet-stream" />
        </staticContent>
 </system.webServer>
Piyush Bhatt
Top achievements
Rank 2
 answered on 03 Feb 2011
1 answer
143 views
Hi,

I want to open the NestedViewTemplate of my radgrid as a modal window instead of it opening below that row. Is this possible or any other way I can achieve this functionality?

Also, I want to make the entire row clickable to expand the row and show the NestedViewTemplate.

Any help or suggestions would be appreciated.

Thank you,
Jay Mehta.

<telerik:radgrid Width="580px" ShowHeader="false" ShowFooter="false" ID="rgModalWindow" runat="server"
                              MasterTableView-NoMasterRecordsText="No Projects Registered" MasterTableView-NoDetailRecordsText="No Projects Registered"
                              CssClass="RadGrid_Default"  HierarchySettings-ExpandTooltip="Edit" HierarchySettings-CollapseTooltip="Edit" >
                                  <MasterTableView RetrieveAllDataFields="false" AutoGenerateColumns="false" CssClass="RadGrid_Default">
                                      <Columns>
                                          <telerik:GridExpandColumn  UniqueName="Expand">
                                              <ItemStyle cssclass="grndt" BorderStyle="none"/>
                                          </telerik:GridExpandColumn> 
 
                                          <telerik:GridTemplateColumn ItemStyle-Width="520px" UniqueName="Name">
                                              <ItemTemplate>
                                              <div class="cdpn" style="border: 0px none;width:520px;">
                                                  <div class="gdesc" style="width:520px;"><asp:Literal ID="litParameter" runat="server"></asp:Literal></div>
                                              </div>
                                              </ItemTemplate>
                                          </telerik:GridTemplateColumn>
                                             
                                          <telerik:GridExpandColumn  UniqueName="Expand1">
                                          <ItemStyle cssclass="expand" BorderStyle="none"/>
                                          </telerik:GridExpandColumn> 
                                      </Columns>
                                       
                                      <NestedViewTemplate>
                                      <table>
                                      <tbody>
                                      <tr>
                                      <td>
                                          <asp:Panel ID="NestedViewPanel" CssClass="rgExpandCol" Width="500px" runat="server" >
                                                  <asp:Literal ID="litScreenID" Visible="false" runat="server"></asp:Literal>
                                                  <asp:Literal ID="litCategoryID" Visible="false" runat="server"></asp:Literal>
                                                  <h2><asp:Label ID="lblInstructions1" Visible="false" runat="server" Text="Label"></asp:Label></h2>
                                                  <br />
                                                  <div class="question-label">
                                                      <asp:Literal ID="lit" runat="server"></asp:Literal>
                                                  </div>
                                                  <div class="answer">
                                                  <asp:RadioButtonList CssClass="radiooption1" ID="rbl" runat="server">
                                                  </asp:RadioButtonList>
                                                  </div>
                                                  <br />
                                                  <asp:Button ID="btnUpdate" CssClass="button" runat="server" Text="Update" />
                                          </asp:Panel>
                                      </td>
                                      </tr>
                                      </tbody>
                                      </table>
                                      </NestedViewTemplate>
                                  </MasterTableView>
                                   
                              </telerik:radgrid>
Veli
Telerik team
 answered on 03 Feb 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?