Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
239 views
Hi

I am trying to add an ImageClickEventHandler onto an imagebutton.
Althought i cant get it to fire. I am doing this within the ItemDataBound event of the grid . I tried changing EnableViewState to false, but that made no difference.

Any ideas would be greatly appreciated

    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)    
    {  
        ImageButton imgBtnHolder = new ImageButton();  
 
       if (e.Item is GridDataItem)    
        {  
            switch (e.Item.OwnerTableView.Name)  
            {  
 
                case "Vis":  
                    {  
                        GridDataItem item = (GridDataItem)e.Item;  
 
                     
 
                        imgBtnHolder = ((ImageButton)item["colDelete"].FindControl("imgDelete"));  
                        imgBtnHolder.ImageUrl = "data_delete.gif";  
                        imgBtnHolder.AlternateText = "Delete";  
                        imgBtnHolder.OnClientClick = "return confirm('Are you sure you want to remove this');";  
                        imgBtnHolder.CommandName = "Delete";  
                        imgBtnHolder.CommandArgument = "cccc";  
                        imgBtnHolder.Click +=new ImageClickEventHandler(imgBtnHolder_Click);  
                          
                        break;  
                    }  
 
               
            }  
                         
        }    
    }  
 
    
    void imgBtnHolder_Click(object sender, ImageClickEventArgs e)  
    {  
        throw new NotImplementedException();  
    } 

Thanks

 

Princy
Top achievements
Rank 2
 answered on 30 Mar 2011
2 answers
97 views
Hi,
I have a custom provider that Ive created and its works fine with the default edit form. The issue that Im running into is that once I modify my RadScheduler to use an advanced edit form, none of the drop down controls (all of which are populated via resources in the custom provider) have the selected value in edit mode.
Ive tried adding binding expressions for each of the controls in the advanced edit and insert templates, but when I do that I get an error saying that that the Appointment object does not have a definition for a property.
To get around that I can add the CustomAttributes to the radScheduler definition but then the control does not save the data. Also, Im not working with attributes, they are resources.

Can telerik please provide some guidance on this? and please don't recommend that I read the Advanced Templates Demo. Ive read it a number of times and it has not helped.
Veronica
Telerik team
 answered on 30 Mar 2011
1 answer
97 views
I built a custom provider that has mutlivalues for field called attendees.  When I just run that as is (without changing the advanced template) the list of attendees shows up but there are no check-boxes to select from.  Do you know why?

Thanks.
Veronica
Telerik team
 answered on 30 Mar 2011
3 answers
319 views
Hi All,
    In our application we have a dynamically generated Bar Chart and to this bar chart we are creating ChartSeries and adding ChartSeries item and while adding the items to the series i am trying to register a click event for the ActiveRegion and the code is as below in bold but the event never gets fired.

ChartSeries

s0 = new ChartSeries();  

s0.Name =

 

string.Empty;  

 

for (int ic = 0; ic < dt.Rows.Count; ic++)  

 

ChartSeriesItem seriesItem = new ChartSeriesItem();  

seriesItem.YValue = (

 

double)dt.Rows[ic]["Quantity"];  

seriesItem.Name =

 

"Settlement";  

seriesItem.Appearance.Border.Color =

 

Color.Black;  

 

DateTime dt1 = Convert.ToDateTime(dt.Rows[ic]["Date"]);  

seriesItem.XValue = dt1.ToOADate();

seriesItem.ActiveRegion.Click +=

 

new RegionClickEventHandler(ActiveRegion_Click);  

seriesItem.ActiveRegion.Tooltip =

"Number of News:" + dt.Rows[ic]["Quantity"] + "";  

 

 

RadToolTipManager1.TargetControls.Add(

null, seriesItem.ActiveRegion.Tooltip.ToString(), true);  

 

 

s0.AddItem(seriesItem);

}

 

 

radchart1.Series.Add(s0); 
I even tried the below  way of registering the click event for the Active region at chart level but in vain.

 

radchart1.ChartTitle.ActiveRegion.Click +=

 

new RegionClickEventHandler(ActiveRegion_Click);

Please correct me if i am doing something wrong.

Regards,
Preetam.

 

 

Ves
Telerik team
 answered on 30 Mar 2011
1 answer
141 views
Hi All,

I am trying to remove this design-time created CheckBox at run-time, client-side. I am able to remove the control in Chrome and FireFox, but IE8 is putting up a fight and I do not know why. 

My Mark-Up:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LocalSettings.aspx.cs" Inherits="Cormant_Web_Dashboard.LocalSettings" %>
 
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
    <link href="~/Styles/LocalSettings.css" rel="Stylesheet" type="text/css" />
</head>
<body onload="AdjustRadWindowOnFirstLoad();">
    <form id="form1" runat="server">
 
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server">
    </telerik:RadStyleSheetManager>
 
    <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
    </telerik:RadScriptManager>
    <telerik:RadFormDecorator ID="RadFormDecorator1" Runat="server" DecoratedControls="All" Skin="Web20" />
 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
        UpdatePanelsRenderMode="Inline">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="CheckBox1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadNumericTextBox1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadComboBox1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Label1" />
                    <telerik:AjaxUpdatedControl ControlID="Label2" />
                    <telerik:AjaxUpdatedControl ControlID="CheckBox3" />
                    <telerik:AjaxUpdatedControl ControlID="RadDateTimePicker2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="CheckBox2">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadDateTimePicker1" />
                    <telerik:AjaxUpdatedControl ControlID="RadDateTimePicker2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadButton1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadButton1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
 
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function CloseAndSave(args) {
                var oWindow = GetRadWindow();
                var resultArguments = new Array();
                resultArguments.push(document.getElementById('<%= CheckBox1.ClientID %>').checked);
                resultArguments.push($find("<%= RadNumericTextBox1.ClientID %>").get_value());
                resultArguments.push($find("<%= RadComboBox1.ClientID %>").get_value());
                resultArguments.push(document.getElementById('<%= CheckBox2.ClientID %>').checked);
                if (document.getElementById('CheckBox2').checked == true) {
                    var RadDateTimePicker1 = $find("<%= RadDateTimePicker1.ClientID %>");
                    if (resultArguments[2] == "LineChart") {
                        var RadDateTimePicker2 = $find("<%= RadDateTimePicker2.ClientID %>");
 
                        if (RadDateTimePicker1.isEmpty() || RadDateTimePicker2.isEmpty()) {
                            alert("Please provide values for both dates.");
                            return;
                        }
                        else {
                            var Date1 = RadDateTimePicker1.get_selectedDate();
                            var Date2 = RadDateTimePicker2.get_selectedDate();
 
                            if ((Date2 - Date1) < 0) {
                                alert("The second date should be past the first.");
                                return;
                            }
 
                            resultArguments.push(Date1.format("MM/dd/yyyy hh:mm:ss"));
                            resultArguments.push(Date2.format("MM/dd/yyyy hh:mm:ss"));
 
                        }
                    }
                    else if (resultArguments[2] == "PieChart") {
                        if (RadDateTimePicker1.isEmpty()) {
                            alert("Please enter a date.");
                            return;
                        }
                        resultArguments.push(RadDateTimePicker1.get_selectedDate().format("MM/dd/yyyy hh:mm:ss"));
                        resultArguments.push(null);
                    }
                }
                else {
                    resultArguments.push(null);
                    resultArguments.push(null);
                }
 
                if (document.getElementById('<%= CheckBox3.ClientID %>') != null) {
                    resultArguments.push(document.getElementById('<%= CheckBox3.ClientID %>').checked);
                }
                else {
                    resultArguments.push(null);
                }
 
                oWindow.close(resultArguments);
            }
 
            function GetRadWindow() {
                var oWindow = null;
                if (window.radWindow) oWindow = window.radWindow;
                else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
                return oWindow;
            }
 
            var doPostback = true;
            function pageLoad() {
                var oWindow = GetRadWindow();
                properties = oWindow.argument;
 
                if (properties) {
                    if (properties["AutoRefreshEnabled"] == "True") {
                        document.getElementById('<%= CheckBox1.ClientID %>').checked = true;
                        $find("<%= RadNumericTextBox1.ClientID %>").set_value(properties["AutoRefreshInterval"]);
                        $find("<%= RadNumericTextBox1.ClientID %>").enable();
                    }
 
                    doPostback = false;
                    $find("<%= RadComboBox1.ClientID %>").findItemByValue(properties["ChartType"]).select();
                    doPostback = true;
 
                    if (properties["ChartType"] == "PieChart") {
                        document.getElementById('<%= CheckBox3.ClientID %>').style.display = 'none';
                        document.getElementById('<%= Label2.ClientID %>').style.display = 'none';
                        //document.getElementById('<%= CheckBox3.ClientID %>').style.visibility = 'hidden';
                        //document.getElementById('<%= Label2.ClientID %>').style.visibility = 'hidden';
                        $find("<%=RadDateTimePicker2.ClientID %>").set_visible(false);
                    }
 
 
                    if (properties["TimeRestrictionEnabled"] == "True") {
                        document.getElementById('<%= CheckBox2.ClientID %>').checked = true;
 
                        if (properties["ChartType"] == "LineChart") {
                            $find("<%= RadDateTimePicker1.ClientID %>").set_enabled(true);
                            $find("<%= RadDateTimePicker2.ClientID %>").set_enabled(true);
                            $find("<%= RadDateTimePicker1.ClientID %>").set_selectedDate(new Date(properties["TimeStart"]));
                            $find("<%= RadDateTimePicker2.ClientID %>").set_selectedDate(new Date(properties["TimeEnd"]));
                        }
                        else if (properties["ChartType"] == "PieChart") {
                            $find("<%= RadDateTimePicker1.ClientID %>").set_enabled(true);
                            $find("<%= RadDateTimePicker1.ClientID %>").set_selectedDate(new Date(properties["TimeStart"]));
                        }
                    }
 
                    if (properties["DataPointsEnabled"] == "True") {
                        document.getElementById('<%= CheckBox3.ClientID %>').checked = true;
                    }
                }
            }
 
            function OnClientSelectedIndexChanged(sender, eventArgs) {
                if (doPostback) {
                    __doPostBack('RadComboBox1', '');
                }
            }
 
            function AdjustRadWindowOnFirstLoad() {
                var oWindow = GetRadWindow();
                if (oWindow.argument != null) {
                    oWindow.argument = null;
                    setTimeout(function () { oWindow.autoSize(true); if ($telerik.isChrome || $telerik.isSafari) ChromeSafariFix(oWindow); }, 500);
                }
            }
 
            function AdjustRadWindow() {
                    var oWindow = GetRadWindow();
                    setTimeout(function () { oWindow.autoSize(true); if ($telerik.isChrome || $telerik.isSafari) ChromeSafariFix(oWindow); }, 500);
            }
 
            //fix for Chrome/Safari due to absolute positioned popup not counted as part of the content page layout
            function ChromeSafariFix(oWindow) {
                var iframe = oWindow.get_contentFrame();
                var body = iframe.contentWindow.document.body;
 
                setTimeout(function () {
                    var height = body.scrollHeight;
                    var width = body.scrollWidth;
 
                    var iframeBounds = $telerik.getBounds(iframe);
                    var heightDelta = height - iframeBounds.height;
                    var widthDelta = width - iframeBounds.width;
 
                    if (heightDelta > 0) oWindow.set_height(oWindow.get_height() + heightDelta);
                    if (widthDelta > 0) oWindow.set_width(oWindow.get_width() + widthDelta);
                    oWindow.center();
 
                }, 310);
            }
        </script>
    </telerik:RadCodeBlock>
 
        <fieldset>
            <legend>Refresh Settings</legend>
            <table>
                <tr>
                    <td class="AutoRefreshEnabled">
                        <asp:Label ID="Label1" runat="server" Text="Auto-Refresh Enabled:"></asp:Label>
                    </td>
                    <td class="AutoRefreshCheckbox">
                    <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" oncheckedchanged="CheckBox1_CheckedChanged" />
                    </td>
                    <td class="AutoRefreshNumericTextbox">
                        <telerik:RadNumericTextBox ID="RadNumericTextBox1" Runat="server"
                            Label="Auto-Refresh Interval (Minutes):" MaxValue="60" MinValue="0"
                            ShowSpinButtons="True" Value="0" Width="225px" Enabled="False"
                            LabelCssClass="riLabel LabelDisabled">
                        <NumberFormat DecimalDigits="0" />
                        </telerik:RadNumericTextBox>
                    </td>
                </tr>
            </table>
        </fieldset>
 
        <fieldset>
            <legend>Chart Properties</legend>
            <telerik:RadComboBox ID="RadComboBox1" Runat="server" Skin="Web20"
                onselectedindexchanged="RadComboBox1_SelectedIndexChanged"
                onclientselectedindexchanged="OnClientSelectedIndexChanged">
                <Items>
                    <telerik:RadComboBoxItem runat="server" Text="Line Chart" Value="LineChart" />
                    <telerik:RadComboBoxItem runat="server" Text="Pie Chart" Value="PieChart" />
                </Items>
            </telerik:RadComboBox>
            <table>
                <tr>
                    <td class="TimeframeRestricted">
                        Timeframe Restricted:</td>
                    <td class="TimeframeCheckbox">
                        <asp:CheckBox ID="CheckBox2" runat="server" AutoPostBack="True" oncheckedchanged="CheckBox2_CheckedChanged" />
                    </td>
                    <td class="TimeframeDateTimePickers">
                        <telerik:RadDateTimePicker ID="RadDateTimePicker1" Runat="server" Skin="Web20" Enabled="False" Culture="en-US" EnableTyping="False" PopupDirection="TopLeft">
                            <TimeView runat="server" CellSpacing="-1">
                            </TimeView>
                            <TimePopupButton CssClass="rcTimePopup rcDisabled" ImageUrl="" HoverImageUrl="">
                            </TimePopupButton>
 
                            <Calendar runat="server" Skin="Web20" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False" ViewSelectorText="x">
                            </Calendar>
                            <DateInput runat="server" DateFormat="M/d/yyyy" DisplayDateFormat="M/d/yyyy" readonly="True">
                            </DateInput>
                            <DatePopupButton CssClass="rcCalPopup rcDisabled" ImageUrl="" HoverImageUrl="">
                            </DatePopupButton>
                            <ClientEvents OnPopupClosing="AdjustRadWindow" OnPopupOpening="AdjustRadWindow" />
                        </telerik:RadDateTimePicker>
                    </td>
                </tr>
                <tr>
                    <td class="DataPointsShown">
                        <asp:Label ID="Label2" runat="server" Text="Data Points Shown:"></asp:Label>
                    </td>
                    <td class="DatapointsCheckbox">
                        <asp:CheckBox ID="CheckBox3" runat="server" AutoPostBack="True" />
                    </td>
                    <td class="TimeframeDateTimePickers">
                        <telerik:RadDateTimePicker ID="RadDateTimePicker2" Runat="server" Skin="Web20" Enabled="False" Culture="en-US" EnableTyping="False" PopupDirection="TopLeft">
                            <TimeView runat="server" CellSpacing="-1">
                            </TimeView>
                            <TimePopupButton CssClass="rcTimePopup rcDisabled" ImageUrl="" HoverImageUrl="">
                            </TimePopupButton>
 
                            <Calendar runat="server" Skin="Web20" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False" ViewSelectorText="x">
                            </Calendar>
                            <DateInput runat="server" DateFormat="M/d/yyyy" DisplayDateFormat="M/d/yyyy" readonly="True">
                            </DateInput>
                            <DatePopupButton CssClass="rcCalPopup rcDisabled" ImageUrl="" HoverImageUrl="">
                            </DatePopupButton>
                            <ClientEvents OnPopupClosing="AdjustRadWindow" OnPopupOpening="AdjustRadWindow" />
                        </telerik:RadDateTimePicker>
                    </td>
                </tr>
            </table>
        </fieldset>
        <div class="BottomButtons">
            <telerik:RadButton ID="RadButton1" runat="server" Skin="Web20" Text="Apply" OnClientClicked="CloseAndSave" >
            </telerik:RadButton>
        </div>
    </form>
</body>
</html>

In my client-side onLoad function I check the combobox's value, and, if its value is PieChart, I attempt to hide some controls on the page from the user. Setting the checkbox's visibility property to Collapse, Hidden, etc.. doesn't do anything. The same with setting its height and width to 0 -- it is still visible. If I disable it, it becomes disabled. I am able to affect the controls on its left and right -- the RadDateTimePicker and the label both disappear in IE8 perfectly fine.

Any suggestions on how to remove this finicky box would be appreciated.

Niko
Telerik team
 answered on 30 Mar 2011
1 answer
471 views
Hello, i've try to add a event (OnClick) on my GridButtonColumn:

if (e.Item.OwnerTableView.Name == "ChildTableName")
{
ImageButton LinkButton = (ImageButton)item["BtnCol"].Controls[0];
LinkButton.ToolTip = ResourceProvider.GetLocalValue("Cfg_Carousel_Peg_Bobbins_Details");
                
// [...] AddAttribute
}

But I need to intercept the button with UniqueName BtnCol value into if statement:

<telerik:GridButtonColumn 
UniqueName="BtnCol" 
ButtonType="ImageButton" 
ImageUrl="Images/Generic/Icons/info.gif"                                  
CommandName="BobbinsDetails">
<HeaderStyle Width="30px"></HeaderStyle>
</telerik:GridButtonColumn>

What?
Thanks
mbro87
Top achievements
Rank 1
 answered on 30 Mar 2011
1 answer
138 views

hi, in the event of

Page_Load

 I added a custom item:

 

 

RadMenuItem

 

 

manageAccessMenuItem = new RadMenuItem("Open Account");

 

 

manageAccessMenuItem.Value =

 

"OpenAccount";

 

 

 

 

I need to achieve 2 things:
1. on this item click i open a radwindow
2. show or enable this item only for a specific files within some specific folders, hide or disable this when right click on empty area or a folder.

please help
thanks in advance

 

Dobromir
Telerik team
 answered on 30 Mar 2011
2 answers
109 views
I have a radgrid and each row has a nestedview.

Inside these nested views, a number of textbox controls are dynamically added using a repeater control.

Some, but not all, of these textboxes require a value to be entered.

If the row is expanded, then validation occurs on the controls that require it. If the row is collapsed, then no validation occurs.

How can I force validation even if the row is collapsed, whether it has ever been expanded or not? As I understand it the nested view isn't loaded until its required? Is there a way to force the nestedviews to be loaded but hidden when the page loads, or can anyone thing of another way around this?

Basically, I need a RadGrid to have a hidden list of controls that are shown when the user expands the row, but need to validate all controls, even if the row hasn't been expanded.


Karl
Top achievements
Rank 1
 answered on 30 Mar 2011
1 answer
102 views
Hi,

I have a menu set to the left of my page inside a pane of the rad splitter. The splitter is working at a 100% height.

The menu can get longer and shorter as the user browses through site, ie: The sub menu items open up underneath the main menu items on the left and extend it.

The problem i am having is this:
 I dont want a scroll bar appearing when the menu is higher than the users viewport, instead I want it to rather display the "GroupSettings" images to scroll the menu. The only problem is it that I dont want to set a fixed height to the GroupSettings option as it will then crop off the menu and look funny if the user viewport is higher than the menu height specified in GroupSettings.

Is there a way to set the value of GroupSettings to 100% height so that it will always sit on the top and bottom edges of the radPane and if the user's viewport becomes smaller than the actual menu height then the scroll buttons will "activate" and the user will be able to scroll the hidden menu items?

I suppose there should be someway to pull the height of the radPane using javascript as it changes and set the groupSettings to use that height. So as you resize the viewport, the radpane height value gets used for the GroupSettings value for the menu?

Your help with this would be greatly appreciated!
arathol
Top achievements
Rank 1
 answered on 30 Mar 2011
1 answer
186 views
Hi,

Can I add  2 data field values from client side in one column.
I need to show a currency value and format in one column which is calculated thorugh stored procedure.

 

<telerik:GridBoundColumn  HeaderText="Currency" DataField="Value" DataField ="Format" UniqueName="SC">

 

 

</telerik:GridBoundColumn>

 


I dont want to add anything in code behind.

Thanks
Princy
Top achievements
Rank 2
 answered on 30 Mar 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?