Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
507 views

Requirements

RadControls version

2009.1.402.35

.NET version

3.5 SP1

Visual Studio version

2008 SP1

programming language

VB.NET / JavaScript

browser support

all browsers supported by RadControls


PROJECT DESCRIPTION
I was recently tasked to display a list of data in a rad grid and alert users if a change they were about to apply would have other changes that might impact the system globally. One of the things that I love about the RadGrid is the integration with RadWindow and the ability to add a confirm dialog before performing a command in the datagrid. However, I needed a way to conditionally set this to alert users only when the change they wanted to apply would affect other places in the system. If the change didn't impact other areas of the system, there was no reason to alarm the user.

Initially, I set up my RadGrid as follows:
        <telerik:RadGrid ID="gridFundList" runat="server" AllowMultiRowSelection="false" 
            AllowAutomaticDeletes="false" AllowAutomaticInserts="false" AllowAutomaticUpdates="false" 
            AllowFilteringByColumn="false" AllowPaging="false" AllowSorting="false" ShowGroupPanel="false" 
            ShowFooter="false" ShowHeader="true" ShowStatusBar="true">  
            <MasterTableView DataKeyNames="FundID" AutoGenerateColumns="false" ShowFooter="true">  
                <Columns> 
                    <telerik:GridButtonColumn UniqueName="Toggle" ButtonType="ImageButton" ImageUrl="~/images/buttonicons/lightbulb_off.png" 
                        CommandName="ToggleReadable" ConfirmDialogType="RadWindow" ConfirmText="Are you sure you wish to change the global access settings for this fund?<br/><br/><strong>All</strong> applied rules for individual users <strong>will be</strong> removed.<br/><br/>Click <strong>OK</strong> to continue." 
                        ConfirmTitle="Change Global Settings">  
                        <ItemStyle Width="30px" /> 
                    </telerik:GridButtonColumn> 
                    <telerik:GridBoundColumn UniqueName="FundID" DataField="FundID" DataFormatString="{0:00}" 
                        HeaderText="Fund">  
                        <ItemStyle Width="75px" HorizontalAlign="Center" VerticalAlign="Top" /> 
                        <HeaderStyle HorizontalAlign="Center" /> 
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn UniqueName="Desc" DataField="FundName" HeaderText="Description">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn UniqueName="Count" DataField="TotalCostCenterItemsInFund" 
                        HeaderText="Items In Fund" DataFormatString="{0:#,##0} items found." Aggregate="Sum">  
                        <ItemStyle HorizontalAlign="Right" Width="125px" /> 
                        <FooterStyle HorizontalAlign="Right" /> 
                        <HeaderStyle HorizontalAlign="Center" /> 
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn UniqueName="RuleCount" DataField="FundRulesApplied" HeaderText="Rules Applied" 
                        DataFormatString="{0:#,##0} rules applied." Aggregate="Sum">  
                        <ItemStyle HorizontalAlign="Right" Width="125px" /> 
                        <FooterStyle HorizontalAlign="Right" /> 
                        <HeaderStyle HorizontalAlign="Center" /> 
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn UniqueName="CreateDate" DataField="CreateDate" DataFormatString="{0:d} at {0:t}" 
                        HeaderText="Created">  
                        <ItemStyle Width="150px" /> 
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn UniqueName="ModifyDate" DataField="ModifyDate" DataFormatString="{0:d} at {0:t}" 
                        HeaderText="Modified">  
                        <ItemStyle Width="150px" /> 
                    </telerik:GridBoundColumn> 
                </Columns> 
            </MasterTableView> 
        </telerik:RadGrid> 
 

This worked great, but every time a user clicked on the ToggleReadable command they were prompted that they might remove existing rules. I could imagine a scenario where I would be receiving calls every time a user wanted to make a change, afraid they were about to break something.

After investigating the HTML output, I discovered how easy this really is to implement on a conditional basis. Hopefully this will be helpful to others. The output generated an onclick event for the image button with the following javascript:

if(!$find('<GridID>').confirm('<Message>', event, '<Window Title>'))return false; 

This code needed to be placed on the ImageButtons that needed a confirm dialog box.

To start, remove the ConfirmDialogType, ConfirmText and ConfirmTitle attributes of the GridButtonColumn.
<telerik:GridButtonColumn UniqueName="Toggle" ButtonType="ImageButton"   
     ImageUrl="~/images/buttonicons/lightbulb_off.png" 
     CommandName="ToggleReadable">  
          <ItemStyle Width="30px" /> 
</telerik:GridButtonColumn> 
 

Then handle the ItemDataBound event of the RadGrid with code similar to the following:
    Protected Sub gridFundList_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles gridFundList.ItemDataBound  
        If e.Item.ItemType = Telerik.Web.UI.GridItemType.AlternatingItem Or e.Item.ItemType = Telerik.Web.UI.GridItemType.Item Then 
            Dim item As TUI.GridDataItem = DirectCast(e.Item, TUI.GridDataItem)  
            Dim data As Fund = item.DataItem  
 
            Dim btnToggle As ImageButton = DirectCast(item("Toggle").Controls(0), ImageButton)  
 
                If data.FundRulesApplied > 0 Then 
                   ' This will affect other areas of the system.  
                   ' Alert the user!  
                    Dim message As String = "This change will impact other places in the system. Click OK to continue."   
                    btnToggle.Attributes.Add("onclick", "if(!$find('" & gridFundList.ClientID & "').confirm('" & message & "', event, 'Change Global Settings'))return false;")  
                End If 
        End If 
    End Sub 
 
Quesnay MALANDA
Top achievements
Rank 1
 answered on 22 Mar 2010
1 answer
103 views
Should ShowStatusBar='True' always show status bar or only when the bottom paging is available?
I am looking to make use of its progress box in the lower left corner so hierarchical expand / filter / sort.
It's not showing when paging is not needed.
Pavlina
Telerik team
 answered on 22 Mar 2010
1 answer
112 views
Is it possible to set the fixed height of the each row and put longer text than visible into Tooltip f.ex.?
TableLayout fixed doesn't work :(
Dimo
Telerik team
 answered on 22 Mar 2010
1 answer
89 views
Hi all,

Do there exists an overall/master 'OnRequestStart'- and 'OnAjaxRequest'-eventhandler? These events should be firede always even if it is on a usercontrol at a ajaxmanagerproxy or in a radwindow at a subpage. I can do some of it by implement it manually at every page, but i would be nice to have a standard way to do it, and by this also get loose of the possibility that i should forget it at some pages/usercontrols.

Cheers,
Kenneth
Tsvetoslav
Telerik team
 answered on 22 Mar 2010
1 answer
210 views
I make a multi column combo box. if we type in that combobox then matched values are returning. But i want that if user hit enter key only then the matched values will return and will not search items on press of any other key. Please suggest me some solution. My html and c# code is given below:

<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadComboBox ID="RadComboBox1" runat="server" Skin="Vista" Height="190px"  
        Width="420px" MarkFirstMatch="true" EnableLoadOnDemand="true"
        HighlightTemplatedItems="true" OnClientItemsRequested="UpdateItemCountField"
        OnDataBound="RadComboBox1_DataBound" OnItemDataBound="RadComboBox1_ItemDataBound"
        OnItemsRequested="RadComboBox1_ItemsRequested"
        OnClientKeyPressing="HandkeKeyPress" >
         <HeaderTemplate>
            <ul>
                <li class="col1">Name</li>
                <li class="col2">Number</li>
                <%--<li class="col3">Title</li>--%>
            </ul>
        </HeaderTemplate>
        <ItemTemplate>
            <ul>
                <li class="col1">
                    <%# DataBinder.Eval(Container.DataItem, "Name") %></li>
                <li class="col2">
                    <%# DataBinder.Eval(Container.DataItem, "Number") %></li>
                <%--<li class="col3">
                    <%# DataBinder.Eval(Container.DataItem, "ContactTitle") %></li>--%>
            </ul>
        </ItemTemplate>
        <FooterTemplate>
            A total of
            <asp:Literal runat="server" ID="RadComboItemsCount" />
            items
        </FooterTemplate>
    </telerik:RadComboBox>

and c# code is:

 private DataTable table;
    protected void Page_Load(object sender, EventArgs e)
    {
       
        DoDataBind();
    }   

    public void DoDataBind()
    {
        DataTable dt = CreateData();       
        RadComboBox1.DataSource = dt.DefaultView;
        RadComboBox1.DataBind();

    }
    protected void RadComboBox1_DataBound(object sender, EventArgs e)
    {
    
        ((Literal)RadComboBox1.Footer.FindControl("RadComboItemsCount")).Text = Convert.ToString(RadComboBox1.Items.Count);
    }
    private DataTable CreateData()
    {
        table = new DataTable();
        table.Columns.Add("Name", typeof(string));
        table.Columns.Add("Number", typeof(int));
        table.Rows.Add(new object[] { "one", "1" });
        table.Rows.Add(new object[] { "two", "2" });
        table.Rows.Add(new object[] { "three", "3" });
        table.Rows.Add(new object[] { "four", "4" });
        table.Rows.Add(new object[] { "five", "5" });
        table.Rows.Add(new object[] { "six", "6" });
        return table;
    }
    protected void RadComboBox1_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
    {

        DataTable dt = new DataTable();
        dt.Columns.Add("Name", typeof(string));
        dt.Columns.Add("Number", typeof(int));
        DataRow[] foundRows;
        foundRows = table.Select("Name LIKE '" + e.Text + "%'");
        foreach (DataRow dr in foundRows)
        {

            dt.ImportRow(dr);
        }
        RadComboBox1.DataSource = dt;
        RadComboBox1.DataBind();
    }

    protected void RadComboBox1_ItemDataBound(object sender, RadComboBoxItemEventArgs e)
    {
        e.Item.Text = ((DataRowView)e.Item.DataItem)["Name"].ToString() + " (" +((DataRowView)e.Item.DataItem)["Number"].ToString() +")";
        e.Item.Value = ((DataRowView)e.Item.DataItem)["Number"].ToString();
    }
Princy
Top achievements
Rank 2
 answered on 22 Mar 2010
1 answer
132 views

Hello, I have the new version of Telerik.Web.UI.dll and i founded a couple of issues.
With the older version this GridCalculatedColumn worked fine.

 

<

 

telerik:GridCalculatedColumn UniqueName="PorcentajeDesv" HeaderText="% Desv." DataFields="DeltaCin,DeltaCout,Porcentaje" Expression="IIF({0}<>0,{1}/{0}*100-Porcentaje,0.00)" DataFormatString="{0:######0.00}" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right" DataType="System.Decimal" Aggregate="Avg" HeaderStyle-Width="55"/>

 

 

 

I will describe the issues:

1 -  Sys.WebForms.PageRequestManagerServerErrorException: Digit expected
This not work if i use expression like that: Expression="IIF({0}<>0,{1}/{0}*100-Porcentaje,0.00)"
If i use this: Expression="({1}/{0})*100-{2}" works ok.

But not work the aggregate AVG. Aggregate="Avg"
If i use Aggregate like count is ok, but not work with Avg.

I have the same problem with DataType="System.Decimal"  in other columns.

The older version Telerik.Web.UI.dll is in production and work fine, with this new version (2010.1.309.35) is too dificult put in production i have all this errors. I need your help please about this problems.

 

 

 

 

Thanks.

 

 

Radoslav
Telerik team
 answered on 22 Mar 2010
3 answers
248 views
Hi telerik,  
             I use RadWindowA to open a new page,we just call it page NewPage,In page NewPage I have a colorpicker ,and I also need to open another RadwindowB in page NewPage, If I set colorpicker "position:relative;" then the RadwindowB can not cover the colorpicker in both IE7 and IE8,if I don's set that property ,It shows different in IE7 and IE8,you can see the attachment file,like the scenario of IE7,when I clicked the colorpicker,it go back to the right position,I hope in iE7 when page load ,the colorpicker in the right position,I'm wondering is there a solution.

Regards,
Jay Wang
Tsvetie
Telerik team
 answered on 22 Mar 2010
1 answer
137 views

i get this error at two dotnetnuke installtions. one after a upgrade from 5.2.3 to 5.3.0 and one after creating a backup and installing the Portal on my local machine than i got this error too.


Kompilierungsfehler

Beschreibung: Fehler bei der Kompilierung einer Ressource, die zur Verarbeitung dieser Anforderung erforderlich ist. Überprüfen Sie die folgenden spezifischen Fehlerdetails, und ändern Sie den Quellcode entsprechend. 

Compilerfehlermeldung: BC30002: Der Typ "Telerik.Web.UI.Widgets.FileSystemContentProvider" ist nicht definiert.

Quellfehler:

Zeile 10: Namespace Telerik.DNN.ProvidersZeile 11: 	Public Class DNNContentProviderZeile 12: 		Inherits Telerik.Web.UI.Widgets.FileSystemContentProviderZeile 13: Zeile 14: 		Public Sub New(ByVal context As HttpContext, ByVal searchPatterns As String(), ByVal viewPaths As String(), ByVal uploadPaths As String(), ByVal deletePaths As String(), ByVal selectedUrl As String, ByVal selectedItemTag As String)

Quelldatei: D:\wwwroot\dresscode\App_Code\TelerikWebUI\RadEditorProvider.vb    Zeile: 12
dnn
Top achievements
Rank 1
 answered on 22 Mar 2010
1 answer
211 views

Hi, I'm trying to do this simple thing but I can't do it yet. I have read some documentation and tried several ways and nothing, so I'd appreciate specific details to perform this task.

Thanks in advance.

BaiH
Top achievements
Rank 1
 answered on 22 Mar 2010
3 answers
182 views
Dear Telerik,

How do you call Radtab pageview id in need data source.

For example:

 

 <telerik:RadTabStrip ID="RadTabStrip1" runat="server" Skin="Black" MultiPageID="RadMultiPage1" 
                        SelectedIndex="0" Width ="300px" ontabclick="RadTabStrip1_TabClick">  
                        <Tabs>  
                            <telerik:RadTab Text="Bronze" PageViewID="Bronze">  
                            </telerik:RadTab>  
                            <telerik:RadTab Text="Silver" PageViewID="Silver">  
                            </telerik:RadTab>  
                            <telerik:RadTab Text="Gold" PageViewID="Gold">  
                            </telerik:RadTab>  
                            <telerik:RadTab Text="Black" PageViewID="Black">  
                            </telerik:RadTab>  
                        </Tabs>  
            </telerik:RadTabStrip> 


protected void grdCard_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)  
        {  
            int CardColour = 0;  
            if (RadTabStrip1.SelectedTab.Text == "Silver")  
            {  
                CardColour = Convert.ToInt32(EnumAutoGenerated.MemberCardType.Silver);  
            }  
            else if (RadTabStrip1.SelectedTab.Text == "Gold")  
            {  
                CardColour = Convert.ToInt32(EnumAutoGenerated.MemberCardType.Gold);  
            }  
            else 
            {  
                CardColour = Convert.ToInt32(EnumAutoGenerated.MemberCardType.Silver);  
            }  
 
            MemberCardCollection oMemberCardCollection = new MemberCardCollection();  
            oMemberCardCollection.Query.Select();  
            oMemberCardCollection.Query.Where(oMemberCardCollection.Query.McrStaIDType.Equal(CardColour));  
            oMemberCardCollection.Query.Load();  
            grdCard.DataSource = oMemberCardCollection;  
 
        } 

 

 

I tried this but it only pick that last colour only, which is 3.

Thank you

Veselin Vasilev
Telerik team
 answered on 22 Mar 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?