Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
227 views
Hello,

My problem scenario:
I want to refresh second RadGrid after delete item from first RadGrid.
I tried use RadGridPrzedmiotyWydzialuBrakKatedry.Rebind()  
in code behind in method: --- protected void RadGridPrzedmiotyWydzialu_DeleteCommand --- 
but it doesn't work.

protected void RadGridPrzedmiotyWydzialu_DeleteCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
    if (e.Item.Cells.Count > 0)
    {
        var db = DatabaseFactory.CreateDatabase();
        var cmd = db.GetStoredProcCommand("katw_Przedmioty_Katedr_upd");
 
        db.AddInParameter(cmd, "@idOsobaDziekan", DbType.Int32, MySession.IdOsoba);
        db.AddInParameter(cmd, "@idWydzial", DbType.Int32, MySession.IdWydzial);
        db.AddInParameter(cmd, "@idPrzedmiot", DbType.Int32, e.Item.Cells[2].Text);
        db.ExecuteNonQuery(cmd);
 
    }
//refresh my grid after delete item from first radgrid
    RadGridPrzedmiotyWydzialuBrakKatedry.Rebind();
    
}


I hope for you help.

First RadGrid  with SqlDataSource

<asp:SqlDataSource ID="SqlDataSourcePrzedmiotyWydzialu" runat="server" ConnectionString="<%$ ConnectionStrings:DefaultDatabaseConnection %>"
    SelectCommand="katw_Przedmioty_Wydzialu_sel" SelectCommandType="StoredProcedure">
    <SelectParameters>
        <asp:ControlParameter ControlID="WydzialRadComboBox" Name="IdWydzial" PropertyName="SelectedValue"
            Type="Int32" />
    </SelectParameters>
</asp:SqlDataSource>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadGridPrzedmiotyWydzialu">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadGridPrzedmiotyWydzialu" LoadingPanelID="RadAjaxLoadingPanel" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadGridPrzedmiotyWydzialuBrakKatedry">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadGridPrzedmiotyWydzialuBrakKatedry" LoadingPanelID="RadAjaxLoadingPanel1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel" runat="server">
</telerik:RadAjaxLoadingPanel>
<telerik:RadGrid ID="RadGridPrzedmiotyWydzialu" runat="server" AllowPaging="True"
    AutoGenerateColumns="False" CellSpacing="0" Culture="pl-PL" GridLines="None"
    HorizontalAlign="Justify" Skin="Simple" OnDeleteCommand="RadGridPrzedmiotyWydzialu_DeleteCommand"
    DataSourceID="SqlDataSourcePrzedmiotyWydzialu">
    <ClientSettings>
        <Selecting CellSelectionMode="None" AllowRowSelect="true" />
    </ClientSettings>
    <MasterTableView NoMasterRecordsText="Brak rekordów do wyÅ›wietlenia." DataKeyNames="IdPrzedmiot"
        CommandItemDisplay="Top" DataSourceID="SqlDataSourcePrzedmiotyWydzialu">
        <CommandItemSettings ExportToPdfText="Export to PDF" RefreshText="OdÅ›wież" ShowAddNewRecordButton="False" />
        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
            <HeaderStyle Width="20px" />
        </RowIndicatorColumn>
        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
            <HeaderStyle Width="20px" />
        </ExpandCollapseColumn>
        <Columns>
            <telerik:GridBoundColumn DataField="IdPrzedmiot" HeaderText="IdPrzedmiot" UniqueName="IdPrzedmiot"
                FilterControlAltText="Filter IdPrzedmiot column" DataType="System.Int32" SortExpression="IdPrzedmiot"
                ReadOnly="true" Visible="false">
            </telerik:GridBoundColumn>
            <telerik:GridButtonColumn CommandName="Edit" UniqueName="EditColumn" ButtonType="ImageButton"
                Text="Edytuj">
                <HeaderStyle Width="3%" />
            </telerik:GridButtonColumn>
            <telerik:GridButtonColumn CommandName="Delete" UniqueName="DeleteColumn"         ButtonType="ImageButton"
                Text="UsuÅ„">
                <HeaderStyle Width="3%" />
            </telerik:GridButtonColumn>
            <telerik:GridBoundColumn DataField="Nazwa" HeaderText="Nazwa przedmiotu" UniqueName="Nazwa"
                FilterControlAltText="Filter Nazwa column" DataType="System.String" SortExpression="Nazwa"
                ReadOnly="true">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Kod" HeaderText="Kod" UniqueName="Kod" FilterControlAltText="Filter Kod column"
                DataType="System.String" SortExpression="Kod" ReadOnly="true">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="IdKatedra" HeaderText="IdKatedra" UniqueName="IdKatedra"
                FilterControlAltText="Filter IdKatedra column" DataType="System.Int32" ReadOnly="true"
                Visible="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="KatedraNazwa" HeaderText="Katedra" UniqueName="Katedra"
                FilterControlAltText="Filter Katedra column" DataType="System.String" SortExpression="Katedra"
                ReadOnly="true">
            </telerik:GridBoundColumn>
        </Columns>
        <EditFormSettings EditFormType="WebUserControl" UserControlName="PrzedmiotyKatedre.ascx">
            <EditColumn FilterControlAltText="Filter EditCommandColumn column" ButtonType="ImageButton">
            </EditColumn>
        </EditFormSettings>
    </MasterTableView>
</telerik:RadGrid>

Second RadGrid with SqlDataSource:

<asp:SqlDataSource ID="SqlDataSourcePrzedmiotyWydzialuBrakKatedry" runat="server"
                        ConnectionString="<%$ ConnectionStrings:DefaultDatabaseConnection %>" SelectCommand="katw_Przedmioty_Wydzialu_BrakKatedry_sel"
                        SelectCommandType="StoredProcedure">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="WydzialRadComboBox" Name="IdWydzial" PropertyName="SelectedValue"
                                Type="Int32" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
                    </telerik:RadAjaxLoadingPanel>
                    <telerik:RadGrid ID="RadGridPrzedmiotyWydzialuBrakKatedry" runat="server" AllowPaging="true"
                        AutoGenerateColumns="false" CellSpacing="0" Culture="pl-PL" DataSourceID="SqlDataSourcePrzedmiotyWydzialuBrakKatedry"
                        GridLines="None" HorizontalAlign="Justify" Skin="Simple">
                        <ClientSettings>
                            <Selecting CellSelectionMode="None" />
                        </ClientSettings>
                        <MasterTableView DataSourceID="SqlDataSourcePrzedmiotyWydzialuBrakKatedry" NoMasterRecordsText="Brak rekordów do wyÅ›wietlenia."
                            DataKeyNames="IdPrzedmiot" CommandItemDisplay="Top">
                            <CommandItemSettings ExportToPdfText="Export to PDF" RefreshText="OdÅ›wież" ShowAddNewRecordButton="False" />
                            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
                                <HeaderStyle Width="20px" />
                            </RowIndicatorColumn>
                            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
                                <HeaderStyle Width="20px" />
                            </ExpandCollapseColumn>
                            <Columns>
                                <telerik:GridBoundColumn DataField="IdPrzedmiot" HeaderText="IdPrzedmiot" UniqueName="IdPrzedmiot"
                                    FilterControlAltText="Filter IdPrzedmiot column" DataType="System.Int32" SortExpression="IdPrzedmiot"
                                    ReadOnly="true" Visible="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridButtonColumn CommandName="Edit" Text="Edytuj" UniqueName="EditColumn"
                                    ButtonType="ImageButton">
                                    <HeaderStyle Width="3%" />
                                </telerik:GridButtonColumn>
                                <telerik:GridBoundColumn DataField="Nazwa" HeaderText="Nazwa przedmiotu" UniqueName="Nazwa"
                                    FilterControlAltText="Filter Nazwa column" DataType="System.String" SortExpression="Nazwa"
                                    ReadOnly="true">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Kod" HeaderText="Kod" UniqueName="Kod" FilterControlAltText="Filter Kod column"
                                    DataType="System.String" SortExpression="Kod" ReadOnly="true">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="IdKatedra" HeaderText="IdKatedra" UniqueName="IdKatedra"
                                    FilterControlAltText="Filter IdKatedra column" DataType="System.Int32" ReadOnly="true"
                                    Visible="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="KatedraNazwa" HeaderText="Katedra" UniqueName="Katedra"
                                    FilterControlAltText="Filter Katedra column" DataType="System.String" SortExpression="Katedra"
                                    ReadOnly="true">
                                </telerik:GridBoundColumn>
                            </Columns>
                            <EditFormSettings EditFormType="WebUserControl" UserControlName="PrzedmiotyKatedre.ascx">
                                <EditColumn FilterControlAltText="Filter EditCommandColumn column" ButtonType="ImageButton">
                                </EditColumn>
                            </EditFormSettings>
                        </MasterTableView>
                    </telerik:RadGrid>

Michal
Top achievements
Rank 1
 answered on 14 Jun 2012
1 answer
90 views
Hi,
I have a requirement to have Basic filtering on date columns and Google like filtering on rest of the columns.
Is that possible? I would appreciate if you can provide sample or direct me to tutorial/documentation.
Eyup
Telerik team
 answered on 14 Jun 2012
1 answer
106 views
Is there a way to position the filter arrow on a column in a radgrid differently? I would like to move the arrow to the front of the column instead of having it after the heading title. Is this possible?

Regards, John
Eyup
Telerik team
 answered on 14 Jun 2012
1 answer
100 views

Hi,

I am using radgrid with 4 pages where pagesize is set to 15.Now i navigate to page 2 edit  some of cells and come back to
page 1 and click on save when try to loop through the grid items using
  foreach (GridDataItem ObjeACH in rdGrdMenu.Items)
            {
} I will get only first 15 items of first page.
I want to loop through all items of grid. How can i do that ? is there any way to accomplish ??

Regards,
Akki
Pavlina
Telerik team
 answered on 14 Jun 2012
4 answers
920 views
Hi,
I've set the data source of the RadGrid dynamically. Now I'm trying to set the cell formatting of the RadGrid because in my case i've to set different formatting (bold, italic, underline etc) of the each grid cell. For example, i want to set the font bold to true for the only first row and first column which will be basically first cell of the grid. i.e.

I've tried to do using the following code but in vain. One more thing, i'm not able to see the cell value at this point. I've tried both the ItemCreated and ItemDataBoudn event but nothing is working for me.

protected

 

void RadGridComparableAnalysis_ItemDataBound(object sender, GridItemEventArgs e) {

 

      

if (e.Item is GridDataItem) {

 

        e.Item.Cells[0].Font.Bold =

true
    }
}

 

 

Jim Foster
Top achievements
Rank 1
 answered on 14 Jun 2012
3 answers
143 views
Hi!

I am trying to do some javascript work in my RadGrid insert item template, but it won't even do an alert for me.  No error on my Chrome console or anything, just when I click "insert item" and it loads up the edit template, none of the javascript runs.  

Help!

 -Brett
Eyup
Telerik team
 answered on 14 Jun 2012
5 answers
143 views
I've been using RadToolTipManager in medium trust environment without any problems. Since upgrading to the 2012 Q2 release I get the following exception. Nothing changed on the page or the environment except upgrading from 2012 Q1 to Q2.

Security Exception

Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request failed.

Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 
[SecurityException: Request failed.] 
System.Security.CodeAccessSecurityEngine.ThrowSecurityException(RuntimeAssembly asm,
    PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh
    , SecurityAction action, Object demand, IPermission permThatFailed) +168
System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString,
    PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh,
    SecurityAction action, Object demand, IPermission permThatFailed) +100
System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants,
    PermissionSet refused, PermissionSet demands, RuntimeMethodHandleInternal rmh,
    Object assemblyOrString, SecurityAction action, Boolean throwException) +278
System.Security.PermissionSetTriple.CheckSetDemand(PermissionSet demandSet,
    PermissionSet& alteredDemandset, RuntimeMethodHandleInternal rmh) +69
System.Security.PermissionListSet.CheckSetDemand(PermissionSet pset,
    RuntimeMethodHandleInternal rmh) +156
System.Security.PermissionListSet.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet) +33
System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(
    Int32 permission, PermissionSet targetGrant, CompressedStack securityContext) +128
System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission,
    PermissionSet targetGrant) +54
Marin Bratanov
Telerik team
 answered on 14 Jun 2012
5 answers
161 views
Hi,

I set up a simple example of the issue I'm seeing, using one of the free demos online.  The mark-up for the splitter looks like this.

<telerik:RadSplitter id="RadSplitter1" runat="server" height="200" width="500">
                <telerik:RadPane id="RadPane1" runat="server">Left Pane -
                    set to <b>free</b> size </telerik:RadPane>
                <telerik:RadSplitBar id="RadSplitbar1" runat="server"></telerik:RadSplitBar>
                <telerik:RadPane id="RadPane2" runat="server">Middle Pane - set to <b>free</b> size </telerik:RadPane>
                <telerik:RadSplitBar id="RadSplitbar2" runat="server"></telerik:RadSplitBar>
                <telerik:RadPane id="Radpane3" runat="server">End Pane - set to <b>free</b> size
                </telerik:RadPane>
            </telerik:RadSplitter>

While in run-time the splitter control and all panes display correctly, but in DesignMode the panes are displayed on top of each other, instead of side by side.

Is there any way to correct the look of the panes in DesignMode?

Thanks in advance,
Tom

Dobromir
Telerik team
 answered on 14 Jun 2012
3 answers
298 views
Hi,
I have one rad grid with export to pdf functionality. I have put one html table in item command template which contains, image, report name, generated datetime etc. I add this table which looks like report header. But when I click on export to pdf link in command item template, it does not export command item template data. If I remove table and write text direct into command item template than it works fine and I can see text from command item template to pdf. But I can't format header data without table so I can't remove table from command item template. Export to excel and word works fine.

Can any one help me in this? Columns in below grid are generating at run time.

<telerik:RadGrid ID="radGridReportData" runat="server" BorderStyle="None" GridLines="None"
        AutoGenerateColumns="false" ShowFooter="true" Width="1000px" AllowPaging="false"
        AllowSorting="true" AllowFilteringByColumn="true" AllowAutomaticUpdates="false"
        ShowGroupPanel="false" OnNeedDataSource="radGridReportData_NeedDataSource" OnItemCommand="radGridReportData_ItemCommand"
        OnItemCreated="radGridReportData_ItemCreated" OnItemDataBound="radGridReportData_ItemDataBound">
        <ExportSettings IgnorePaging="true" OpenInNewWindow="true">
            <Pdf PageHeight="210mm" PageWidth="297mm" PageBottomMargin="20mm" PageTopMargin="20mm"
                PageLeftMargin="20mm" PageRightMargin="20mm" />
        </ExportSettings>
        <ClientSettings AllowGroupExpandCollapse="True" ReorderColumnsOnClient="False" AllowDragToGroup="false"
            AllowColumnsReorder="False" EnableRowHoverStyle="True">
            <Selecting AllowRowSelect="false" />
            <ClientEvents OnGridCreated="OnGridCreated" />
        </ClientSettings>
        <GroupingSettings ShowUnGroupButton="true" CaseSensitive="false" />
        <MasterTableView Width="100%" CommandItemDisplay="Top" GroupLoadMode="Client" ShowGroupFooter="true">
            <CommandItemTemplate>
                <div>
                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                        <tr>
                            <td colspan="2" valign="top" align="center" style="color: White; font-weight: bold;
                                font-size: 16px;">
                                <%# radComboReport.Text %>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" valign="top" style="color: White;">
                                <table border="0" cellpadding="0" cellspacing="0" width="1000px">
                                    <tr>
                                        <td valign="top" style="color: White; width: 800px;">
                                            <b>Source: </b>
                                            <%# radComboSource.Text %>
                                        </td>
                                        <td valign="top" style="color: White;">
                                            <b>Run By:</b>
                                            <%# GetUserName() %>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td valign="top" style="color: White; width: 800px;">
                                            <b>Recon: </b>
                                            <%# radRecons.Text %>
                                        </td>
                                        <td valign="top" style="color: White;">
                                            <b>Run Date:</b>
                                            <%# System.DateTime.Now.ToShortDateString() %>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td valign="top" style="color: White;">
                                <asp:CheckBox ID="chkShowHideFilters" runat="server" CssClass="tdText" Checked="false"
                                    onclick="showHideFilterItem(this.checked);" />
                                <b>Show Filter</b>
                            </td>
                            <td align="right" valign="top" style="color: White;">
                                <b>Export</b
                                <asp:LinkButton ID="btnExportToExcel" runat="server" CommandName="ExportToExcel">
                                                    <img src="Images/Icons/excel.png" alt="Export to Excel" style="border: 0px; vertical-align: middle;" />
                                                       
                                </asp:LinkButton>
                                  
                                <asp:LinkButton ID="btnExportToWord" runat="server" CommandName="ExportToWord">
                                                    <img src="Images/Icons/word.png" alt="Export to Word" style="border: 0px; vertical-align: middle;" />
                                                       
                                </asp:LinkButton>
                                  
                                <asp:LinkButton ID="btnExportToPDF" runat="server" CommandName="ExportToPdf">
                                                    <img src="Images/Icons/pdf.png" alt="Export to PDF" style="border: 0px; vertical-align: middle;" />
                                                       
                                </asp:LinkButton>
                            </td>
                        </tr>
                    </table>
                </div>
            </CommandItemTemplate>
            <HeaderStyle Font-Bold="true" />
            <Columns />
        </MasterTableView>
    </telerik:RadGrid>
Vatsal
Top achievements
Rank 2
 answered on 14 Jun 2012
12 answers
354 views
Hi,
     i am new in telerik control.
     i want to use image rotator using Carousel mode. Like:
    
     http://demos.telerik.com/aspnet-ajax/rotator/examples/carouselmode/defaultcs.aspx

      in this demo the images comes from a specific folder.
     
      i want to load the rotator's images from sql database. is their any help...for me ?
     
David
Top achievements
Rank 1
 answered on 14 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?