Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
69 views
Hi all,

I have a radGrid, and I want that when I click a line, it sends me to an other page (a different page for each line of the grid).
But I don't find an event for "row click"

Thanks
Caro
Top achievements
Rank 1
 answered on 04 Jun 2012
1 answer
219 views
I am trying to use the ASP.Net AJAX grid control with AJAX and web services only. I have run into a few problems with the inplace editing. Specifically, if I use the GridEditCommandColumn, clicking the edit button deletes the grid for some reason. If I add in a typical DataSourceID="SqlDataSource1" to the grid and master table, these buttons work as expected, but I don't want to depend on the SQlDataSource control, I would prefer to use AJAX and a web service. The other problem I had was trying to find the value of the edited inplace control after clicking the update button. I was only able to find the original value. I have attached code snippets below:

     <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <div>
    <telerik:RadGrid ID="RadGrid1" runat="server" CellSpacing="0" GridLines="None" Width="740"
            AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True"
            ShowStatusBar="True"
            Skin="Windows7" EnableEmbeddedSkins="false" AutoGenerateColumns="false"  >
        <ClientSettings>
            <Selecting CellSelectionMode="None" AllowRowSelect="True"></Selecting>
            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
            <Resizing AllowColumnResize="True" AllowRowResize="false" ResizeGridOnColumnResize="false"
                ClipCellContentOnResize="true" EnableRealTimeResize="false" AllowResizeToFit="true" />
            <ClientEvents OnRowSelected="rowSelected" OnCommand="RaiseCommand" />
        </ClientSettings>

    <MasterTableView AutoGenerateColumns="False" DataKeyNames="ICID" EditMode="InPlace" Width="530" FilterItemStyle-HorizontalAlign="Center" >
        <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

        <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
            <HeaderStyle Width="20px"></HeaderStyle>
        </RowIndicatorColumn>

        <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
            <HeaderStyle Width="20px"></HeaderStyle>
        </ExpandCollapseColumn>

        <Columns>
            <telerik:GridEditCommandColumn
                    ButtonType="ImageButton"
                    UniqueName="EditCommandColumn"
                    EditImageUrl="Skins/Windows7/Grid/Edit.gif"
                    CancelImageUrl="Skins/Windows7/Grid/Cancel.gif"
                    UpdateImageUrl="Skins/Windows7/Grid/Update.gif" >
                <ItemStyle CssClass="Button.Windows7" HorizontalAlign="Center" />
                <HeaderStyle Width="60" />
            </telerik:GridEditCommandColumn>
            <telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
                ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                UniqueName="DeleteColumn" ImageUrl="Skins/Windows7/Grid/Delete.gif">
                <HeaderStyle Width="40" />
                <ItemStyle HorizontalAlign="Center" />
            </telerik:GridButtonColumn>

            <telerik:GridBoundColumn DataField="ICID" DataType="System.Int32"
                FilterControlAltText="Filter ICID column" HeaderText="ICID" ReadOnly="True"
                SortExpression="ICID" UniqueName="ICID">
                <HeaderStyle Width="120" HorizontalAlign="Center" />
                <ItemStyle HorizontalAlign="Center" />
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Class"
                FilterControlAltText="Filter Class column" HeaderText="Class"
                SortExpression="Class" UniqueName="Class">
                <HeaderStyle Width="140" HorizontalAlign="Center"  />
                <ItemStyle HorizontalAlign="Center" />
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Config"
                FilterControlAltText="Filter Config column" HeaderText="Config"
                SortExpression="Config" UniqueName="Config">
                <HeaderStyle Width="140" HorizontalAlign="Center" />
                <ItemStyle HorizontalAlign="Center" />
            </telerik:GridBoundColumn>
            <telerik:GridCheckBoxColumn
                DataField="Active" DataType="System.Boolean"
                FilterControlAltText="Filter Active column" HeaderText="Active"
                UniqueName="Active" >
                <HeaderStyle Width="60" HorizontalAlign="Center" />
                <ItemStyle HorizontalAlign="Center" />
            </telerik:GridCheckBoxColumn>
            <telerik:GridBoundColumn DataField="TEC"
                FilterControlAltText="Filter TEC column" HeaderText="TEC" SortExpression="TEC"
                UniqueName="TEC" >
                <HeaderStyle Width="200" HorizontalAlign="Center" />
                <ItemStyle HorizontalAlign="Center" />
            </telerik:GridBoundColumn>
           </Columns>

        <EditFormSettings>
        <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
        </EditFormSettings>

    </MasterTableView>

<FilterMenu EnableImageSprites="False"></FilterMenu>
    </telerik:RadGrid>

The Javascript:

      function UpdateGrid()
        {
            var data = 1;
            PageMethods.GetData(data, callUpdateGrid, callError);
        }

        function callUpdateGrid(result)
        {
            if (null == result)
            {
                alert('No Data');
                return;
            }

            var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
            tableView.set_dataSource(result);
            tableView.dataBind();
        }

        function RaiseCommand(sender, eventArgs)
        {
// *******************************'
// How do I get the new value from the edit control here?
// The value variable always returns the previous value.
// *******************************'

            //retrieve the current commandName and commandArgument
            var cmd = eventArgs.get_commandName();
            var arg = eventArgs.get_commandArgument();
            var result = String.format("CommandName: {0}, CommandArgument: {1}", cmd, arg);
            var value = '';
            if ('Page' != cmd)
            {
                var grid = $find("<%= RadGrid1.ClientID %>");
                var mastertable = grid.get_masterTableView();
                ICID = getDataItemKeyValue(grid, mastertable.get_dataItems()[arg]);
                var row = mastertable.get_dataItems()[arg];
                value = mastertable.getCellByColumnUniqueName(row, "TEC").innerHTML;
            }
            alert(result + ', ' + ICID + ', ' + value);
          
        }

The codebehind:

       [WebMethod]
        public static IList<Model> GetData(int arg)
        {
            IList<Model> ilm = new List<Model>();

            ilm.Add( new Model() { Active = "true", Class = "ABC", Config = "A1", ICID = 1, TEC = "TEC1" });
            ilm.Add(new Model() { Active = "", Class = "DEF", Config = "A2", ICID = 2, TEC = "TEC2" });
            ilm.Add(new Model() { Active = "true", Class = "GHI", Config = "A3", ICID = 3, TEC = "TEC3" });

            return ilm;
        }

Can you tell me how to get inplace editing to work with the code above, and how to get the new values from the edited controls?

Thanks.

Radoslav
Telerik team
 answered on 04 Jun 2012
3 answers
120 views
I have an aspx page that contains an asp:panel that has been ajaxified.  This is working successfully for partial page refreshing within this panel.

There is one scenario that is not working.  In the scenario, I dynamically create a user control inside the ajaxified panel, and inside that user control is a RadXmlHttpPanel. 

I get the following javascript error when the page loads in the browser after the postback:
'EditModeStylectl00_cphLeft_ReportPage1_Filter1_63_selVen...' is undefined.

Within the Visual Studio debugger, I see the error is breaking inside this javascript function:

function

Sys$_Application$add_init(handler)

I think maybe what is happening is that part of what is needed to make the RadXmlHttpPanel work correctly is coming within the response AFTER the end tag for the ajaxified panel.  So after the postback, my browser is ignoring some of the javascript needed to properly wire up or initialize the RadXmlHttpPanel.

Is there a way to dynamically load a RadXmlHttpPanel inside an ajaxified panel without getting this error?

Thank you in advance for any help you can provide,
Mike


Maria Ilieva
Telerik team
 answered on 04 Jun 2012
1 answer
167 views
Hi,
i want to open the new pop up on clicking of contextmenu of radtreeviewnode.
thanks,
Mohinder Goswami.
Princy
Top achievements
Rank 2
 answered on 04 Jun 2012
3 answers
231 views
I have a RadGrid with 1 detail table, which I want populated once, and stored on the client.
I have set the HierarchyLoadMode="Client" on both the Radgrid and the mastertableview of the detailtables.
Within the clientsettings of RadGrid I have set AllowExpandCollapse="true".
When I step though the execution of my code, the '_DetailTableDataBind' event fires once for each 'master' row in the RadGrid (as I would expect) when the RadGrid populates.
I have put 2 buttons on my page 'Expand All' and 'Collapse All' which expand and collapse all grid items by calling a method on the server which iterates  MyGrid.MasterTableView.Items and sets the expanded property to true or false as appropriate. This works as I want.
What doesn't work is if I click the '+' or '-' next to each master row in order to expand or collapse the individual detailtable.
I get a javascript error along the lines of:
$find("ctl00_uws_PageContent_uxMidCol_uxMain_ctl04_AppContent_MyGrid_ctl00") has no properties

Which implies the object hasn't been created client-side?
Can anyone please help?

Vinit
Top achievements
Rank 1
 answered on 04 Jun 2012
1 answer
71 views
Hi,

We bind the scheduler to a web service and appointments show up just fine. Everything works.

However, when I try to add the iCal export, upon button click, the RadScheduler1.Appointments collection is empty. It seems that the appointments loaded via the web service provider are not included with postbacks. Fyi: We do not ajaxify the scheduler control.  

Is there anything special to consider with web service bindings or is iCal there simply not supported?

Thanks you,
Stephan

PS: It would be great to have a page at Telerik where one can see at a glance the features not support or supported with each binding. I am thinking of properties of the Appointment class such as CssClass or ToolTip that are disregarded with web service binding (I am wondering why).
Plamen
Telerik team
 answered on 04 Jun 2012
1 answer
79 views
So heres my issue i changed the maxuploadfilesize from 1 to 10485760. The changes worked on the local site but when i put it on the live server it still had one byte  listed as the max file size. I changed it everywhere there was a maxuploadfilesize across the entire site.  Is there something i could be missing?
Rumen
Telerik team
 answered on 04 Jun 2012
1 answer
233 views
Hai,

I have a radgrid.

<

 

 

Columns>

 

 

 

<telerik:GridTemplateColumn HeaderText="SlNo">

 

 

 

<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Font-Bold="true" Width="4%" />

 

 

 

<ItemStyle HorizontalAlign="Center" Width="4%" />

 

 

 

<ItemTemplate>

 

<%

 

# this.rgByAirline.CurrentPageIndex * this.rgByAirline.PageSize + Container.ItemIndex + 1%>

 

 

 

</ItemTemplate>

 

 

 

</telerik:GridTemplateColumn>

 

 

 

<telerik:GridBoundColumn DataField="Recipe_Id" HeaderText="Recipe_Id" Visible="false">

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridTemplateColumn HeaderText="Recipe">

 

 

 

<HeaderStyle HorizontalAlign="Left" VerticalAlign="Middle" Font-Bold="true" Width="96%" />

 

 

 

<ItemStyle HorizontalAlign="Left" Width="96%" />

 

 

 

<ItemTemplate>

 

 

 

<asp:LinkButton ID="lnkRecipe" runat="server" ToolTip="Click here to see details of the Recipe"

 

 

 

CommandName="PopupWindow" OnClientClick="return PopupWindow(this);" Text='<%#Eval("Recipe_Description") %>'></asp:LinkButton>

 

 

 

<asp:Label ID="ltrRecipeId" runat="server" Visible="false" Text='<%# DataBinder.Eval(Container.DataItem,"Recipe_Id") %>'></asp:Label>

 

 

 

 

</ItemTemplate>

 

 

 

</telerik:GridTemplateColumn>

 

 

 

</Columns>

I want to get the Recipe_Id in the javascript PopupWindow(this);

 

 

 

function PopupWindow(anc) {

 

 

 

debugger;

 

 

 

var rowIndex = anc.parentElement.parentElement.rowIndex;

 

 

 

var grdRowNo = Number(isNaN(rowIndex) ? 0 : rowIndex) + 1;

 

 

 

 

 

 

 

 

 

 

var strTransLblId = 'ctl00_CphMaster_rgByAirline' + ((grdRowNo <= 9) ? '_ctl00_ctl0' : '_ctl00_ctl') + grdRowNo + '_ltrRecipeId';

 

 

 

var intRecipeId = Number(document.getElementById(strTransLblId).innerText);

 

 

 

var oWnd = radopen("FKMS_MMS_Recipe_Detail_Popup.aspx?intRecipeId=" + intRecipeId, "RadWindowPopup");

 

oWnd.setSize(725, 600);

 

 

return false;

 

}

 

I got the row number correctly.
But it shows null reference exception in the following line.

var intRecipeId = Number(document.getElementById(strTransLblId).innerText);

Please help urgently.

 

Shinu
Top achievements
Rank 2
 answered on 04 Jun 2012
1 answer
351 views
Hi,

I need to edit radgrid row in the code behind.

Please help me.
Shinu
Top achievements
Rank 2
 answered on 04 Jun 2012
4 answers
151 views

i am facing a problem with grid excel export, after clicking export the grid is disappearing and nothing happean

MasterPage:

<telerik:RadScriptManager ID="Main_RadScriptManager" runat="server" />
    <telerik:RadAjaxManager ID="Main_RadAjaxManager" runat="server" >
        <AjaxSettings></AjaxSettings>
        <ClientEvents OnRequestStart="OnRequestStart" />
    </telerik:RadAjaxManager>
    <telerik:RadFormDecorator ID="Main_RadFormDecorator" runat="server" DecoratedControls="All" Skin="Office2007" />
    <telerik:RadStyleSheetManager ID="Main_RadStyleSheetManager" runat="server">
    </telerik:RadStyleSheetManager>
    <telerik:RadCodeBlock ID="Main_RadCodeBlock" runat="server">
        <script type="text/javascript">
            function OnRequestStart(sender, args) {
                if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0) {
                    args.set_enableAjax(false);
                }
            }
        </script>
    </telerik:RadCodeBlock>
     
    <asp:UpdatePanel ID="Master_UpdatePanel" runat="server" UpdateMode="Conditional" >
        <ContentTemplate>
            <asp:ContentPlaceHolder ID="Popup_ContentPlaceHolder" runat="server" >
            </asp:ContentPlaceHolder>
        </ContentTemplate>
    </asp:UpdatePanel>


ContentPage:

<asp:Content ID="Content2" ContentPlaceHolderID="Popup_ContentPlaceHolder" runat="Server">
    <telerik:RadSplitter ID="InnerRadSplitter" runat="server" Height="560px" Width="100%"
        Orientation="Horizontal" ResizeMode="AdjacentPane" ResizeWithParentPane="true"
        Skin="Vista">
        <telerik:RadPane ID="SearchRadPane" runat="server" MaxHeight="150" MinHeight="70"
            Scrolling="Y" Width="100%">
            <div class="panel message info">
                 
            </div>
        </telerik:RadPane>
        <telerik:RadSplitBar ID="SearchRadSplitBar" runat="server">
        </telerik:RadSplitBar>
        <telerik:RadPane ID="ResultRadPane" runat="server" Scrolling="None">
            <telerik:RadGrid ID="grdData" AllowPaging="false" AllowSorting="false" runat="server"
                AutoGenerateColumns="false" Width="100%" Height="100%" Skin="Vista" GridLines="None"
                OnItemCreated="grdData_ItemCreated" OnItemCommand="grdData_ItemCommand">
                <ClientSettings EnableAlternatingItems="true" EnableRowHoverStyle="true">
                    <Selecting AllowRowSelect="true" />
                    <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true">
                    </Scrolling>
                </ClientSettings>
                <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true">
                    <Excel Format="ExcelML" />
                </ExportSettings>
                <MasterTableView AutoGenerateColumns="false" Width="100%" CommandItemDisplay="Top">
                    <NoRecordsTemplate>
                        <div style="text-align: center; font-weight: bold">
                            NO_INFO_AVLBL</div>
                    </NoRecordsTemplate>
                    <CommandItemTemplate>
                        <telerik:RadToolBar ID="ReportGenerator_ToolBar" runat="server" Width="100%" EnableRoundedCorners="true"
                            EnableShadows="true" Skin="Vista" OnButtonClick="ReportGenerator_ToolBar_ButtonClick">
                            <Items>
                                <telerik:RadToolBarButton Text="Export" Value="Excel_Export"                           CommandName="ExportGrid" >
                                </telerik:RadToolBarButton>
                            </Items>
                        </telerik:RadToolBar>
                    </CommandItemTemplate>
                </MasterTableView>
            </telerik:RadGrid>
        </telerik:RadPane>
        <telerik:RadPane ID="FooterRadPane" runat="server" Height="70" Scrolling="None" Width="100%"
            Locked="true">
            <div class="mainsection buttons-section" style="margin: 5px;">
                <asp:Button ID="btn_ReportGeneratorRun" runat="server" Text="Search"
                    class="button button-blue" OnClick="btn_ReportGeneratorRun_Click" Width="80px" />
            </div>
        </telerik:RadPane>
    </telerik:RadSplitter>
</asp:Content>

ContentPage Code:

protected void grdData_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item.ItemType == GridItemType.CommandItem)
        {
            RadToolBar ReportGenerator_ToolBar = (RadToolBar)e.Item.FindControl("ReportGenerator_ToolBar");
            RadToolBarItem Excel_Export = ReportGenerator_ToolBar.FindItemByValue("Excel_Export");
            RadScriptManager.GetCurrent(this.Page).RegisterPostBackControl(Excel_Export);
        }
    }
 
protected void ReportGenerator_ToolBar_ButtonClick(object sender, RadToolBarEventArgs e)
    {
        string ErrorMessage = "";
        try
        {
            //---------------------------------------
            if (e.Item.Value == "Excel_Export")
            {
                grdData.ExportSettings.FileName = DateTime.Today.ToString("dd.MM.yyyy");
                 
                grdData.ExportSettings.IgnorePaging = true;
                grdData.ExportSettings.OpenInNewWindow = true;
                grdData.MasterTableView.ExportToExcel();
            }
            //---------------------------------------
        }
        catch (Exception ex)
        {
            ErrorMessage += ex.Message;
        }
    }

Mohamed Salah Al-Din
Top achievements
Rank 1
 answered on 04 Jun 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?