This is a migrated thread and some comments may be shown as answers.

Radbutton, create event click from code behind

6 Answers 1546 Views
Button
This is a migrated thread and some comments may be shown as answers.
Fabio Cirillo
Top achievements
Rank 1
Fabio Cirillo asked on 26 Mar 2013, 12:00 PM
Hi,
in the code behind (vbnet) i created this radtooltip and into tooltip i created this radbutton.

This is the code:

Private button As New RadButton()
 
            button.ID = "btnload"
            button.Text = "load photo"
            button.Skin = "Office2010Silver"
            button.Icon.PrimaryIconCssClass = "rbAdd"
            Dim tip As RadToolTip = New RadToolTip
            tip.ID = "RadTooltip1"
            tip.Controls.Add(button)
            RadAjaxPanel1.Controls.Add(tip)
            tip.TargetControlID = "Imgprofile"
            tip.Width = Unit.Pixel(120)
            tip.Height = Unit.Pixel(30)
            tip.RelativeTo = ToolTipRelativeDisplay.Element
            tip.Position = ToolTipPosition.MiddleRight
            tip.HideEvent = ToolTipHideEvent.ManualClose
            tip.Show()

now i wolud to create a event click of this button because into evento click must start this code:

Dim script As String = "function f(){$find(""" + RadWindowLoadprofile.ClientID + """).show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"
ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "key", script, True)

how can to create the click event?

bye

6 Answers, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 27 Mar 2013, 11:57 AM
Hi Fabio,

Please find below an example on how to add a server-side OnClick event handler to the RadButton:

ASPX:
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
</telerik:RadAjaxPanel>
<telerik:RadButton ID="Imgprofile" runat="server" Text="Click">
</telerik:RadButton>

VB.NET:
Private button As New RadButton()
 
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
 
    button.ID = "btnload"
    button.Text = "load photo"
    button.Skin = "Office2010Silver"
    AddHandler button.Click, AddressOf button_Click
    button.Icon.PrimaryIconCssClass = "rbAdd"
 
    Dim tip As New RadToolTip()
    tip.ID = "RadTooltip1"
    tip.Controls.Add(button)
    RadAjaxPanel1.Controls.Add(tip)
    tip.TargetControlID = "Imgprofile"
    tip.Width = Unit.Pixel(120)
    tip.Height = Unit.Pixel(30)
    tip.RelativeTo = ToolTipRelativeDisplay.Element
    tip.Position = ToolTipPosition.MiddleRight
    tip.HideEvent = ToolTipHideEvent.ManualClose
    tip.Show()
End Sub
 
Protected Sub button_Click(sender As Object, e As EventArgs)
    Dim script As String = "function f(){alert('Button is clicked'); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"
    ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "key", script, True)
End Sub
Where the highlighted text is the attachment of the event handler.

Kind regards,
Danail Vasilev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Fabio Cirillo
Top achievements
Rank 1
answered on 28 Mar 2013, 09:29 AM
hi,
i wrote this:

    Private button, button1 As New RadButton()
    Private tip As RadToolTip = New RadToolTip             
 
    Private Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
button.ID = "btnload"
                button.Text = "Carica foto"
                button.Skin = "Office2010Silver"
                AddHandler button.Click, AddressOf button_Click
                button.Icon.PrimaryIconCssClass = "rbAdd"
                tip.ID = "RadTooltip1"
                tip.Controls.Add(button)
                RadAjaxPanel1.Controls.Add(tip)
                tip.TargetControlID = "Imgprofile"
                tip.Width = Unit.Pixel(120)
                tip.Height = Unit.Pixel(30)
                tip.RelativeTo = ToolTipRelativeDisplay.Element
                tip.Position = ToolTipPosition.Center
                tip.HideEvent = ToolTipHideEvent.ManualClose
                tip.Show()
    End Sub
 
    Protected Sub button_Click(sender As Object, e As EventArgs)
        Dim script As String = "function f(){$find(""" + RadWindowLoadprofile.ClientID + """).show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"
        ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "key", script, True)
    End Sub

but when i click on button no start the event click the targetcontrolid "imgprofile" is a object image asp.

bye
0
Danail Vasilev
Telerik team
answered on 29 Mar 2013, 05:11 PM
Hi Fabio,

I am not sure if I correctly understand what is your actual issue. Nevertheless I have tried to reproduce it but to no avail. You can watch a short video with the test here, and then tell if I am missing something. The code I have used for the test is as follow:

ASPX:
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
</telerik:RadAjaxPanel>
<asp:Image ID="Imgprofile" runat="server" ImageUrl="cb_download.png" />
<telerik:RadWindow ID="RadWindowLoadprofile" runat="server">
</telerik:RadWindow>

VB.NET:
Private button As New RadButton()
Private tip As RadToolTip = New RadToolTip
 
Private Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
    button.ID = "btnload"
    button.Text = "Carica foto"
    button.Skin = "Office2010Silver"
    AddHandler button.Click, AddressOf button_Click
    button.Icon.PrimaryIconCssClass = "rbAdd"
    tip.ID = "RadTooltip1"
    tip.Controls.Add(button)
    RadAjaxPanel1.Controls.Add(tip)
    tip.TargetControlID = "Imgprofile"
    tip.Width = Unit.Pixel(120)
    tip.Height = Unit.Pixel(30)
    tip.RelativeTo = ToolTipRelativeDisplay.Element
    tip.Position = ToolTipPosition.Center
    tip.HideEvent = ToolTipHideEvent.ManualClose
    tip.Show()
End Sub
 
Protected Sub button_Click(sender As Object, e As EventArgs)
    Dim script As String = "function f(){$find(""" + RadWindowLoadprofile.ClientID + """).show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"
    ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "key", script, True)
End Sub

When I hover over the image a tooltip with a RadButton inside of it emerges. When I click on the RadButton the server-side event OnClick triggers and a script that opens a RadWindow is loaded in sys.application.load event.


All the best,
Danail Vasilev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Fabio Cirillo
Top achievements
Rank 1
answered on 02 Apr 2013, 09:13 AM
Your code works fine .. but if I enter the code in the aspx page, the button click event does not work ... can you help me see why?

this is my code:
<head runat="server">
<meta name="description" content="Trycontact; il social network che ti collega alla community con il tuo biglietto da visita virtuale." />
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<title>Trycontact: profilo utente</title>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
function LoadHome(sender, eventArgs) {
var arg = eventArgs.get_argument();
if (arg == 1)
window.location.href("index.aspx");
return false;
}
function OnClientDropDownOpening(sender, eventArgs) {
if (sender.get_selectedItem()) {
sender.set_text("");
}
}
function GetRadWindow() {
var oWindow = null;
if (window.radWindow) oWindow = window.radWindow;
else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
return oWindow;
}
function Close() {
GetRadWindow().close();
}
function Loadimage(sender, argument) {
var strimage = argument._argument;
var divimage = $get("<%= Imgprofile.ClientID %>");
divimage.src = strimage;
}
function CallNotification() {
var PwdAttuale = '<%=ViewState("PasswordAttuale")%>';
var notification = $find("<%= RadNotification1.ClientID %>");
var txtpwdnow = document.getElementById("<%= txtpwdnow.ClientID %>");
var txtpwdnew = document.getElementById("<%= txtpwdnew.ClientID %>");
var txtpwdnewconf = document.getElementById("<%= Txtpwdnewconf.ClientID %>");
if (txtpwdnow.value != PwdAttuale) {
var messaggio = "Password attuale errata.";
notification.set_text(messaggio);
notification.show();
return false;
} else if (txtpwdnew.value != txtpwdnewconf.value) {
var messaggio = "Password di conferma errata.";
notification.set_text(messaggio);
notification.show();
return false;
} else if (txtpwdnow.value.length == 0) {
var messaggio = "Campo password attuale vuoto";
notification.set_text(messaggio);
notification.show();
return false;
} else if (txtpwdnew.value.length == 0) {
var messaggio = "Campo nuova password vuoto";
notification.set_text(messaggio);
notification.show();
return false;
} else if (txtpwdnewconf.value.length == 0) {
var messaggio = "Campo conferma password vuoto";
notification.set_text(messaggio);
notification.show();
return false;
}
return true;
}
function openRaddelete() {
if (raddelete.style.display == 'none') {
confermadelete.style.display = 'none';
raddelete.style.display = 'block';
}
$find("<%= RadWindowProfiledelete.ClientID %>").show();
}
function closeRaddelete() {
$find("<%= RadWindowProfiledelete.ClientID %>").close();
}
function closeRadchangepwd() {
$find("<%= RadWindowChangepwd.ClientID %>").close();
}
function closeRaddelete_redirect() {
$find("<%= RadWindowProfiledelete.ClientID %>").close();
window.location.href("index.aspx");
}
function openRadconfirmdelete() {
raddelete.style.display = 'none';
confermadelete.style.display = 'block';
}
function closeRadprewcard() {
$find("<%= RadWindowAnteprimaCard.ClientID %>").close();
}
function OnFocus1(sender, eventArgs) {
$get('PasswordMask1').style.display = 'none';
$get('Password1').style.display = 'inline';
$find('<%= Radpassword1.ClientID %>').focus();
}
function OnBlur1(sender, eventArgs) {
if (sender.isEmpty()) {
$get('PasswordMask1').style.display = 'inline';
$get('Password1').style.display = 'none';
}
}
function RadComboBox1_KeyPressing(sender, args) {
if (args.get_domEvent().keyCode == 13) {
}
if (args.get_domEvent().keyCode == 9) {
//do something
}
}
function visiblediv() {
spec.style.display = 'none';
clas.style.display = 'block';
}
function visiblediv1() {
spec.style.display = 'block';
clas.style.display = 'none';
}
function KeyPressing(sender, args) {
//If ENTER was pressed
if (args.get_domEvent().keyCode == 13) {
}
//If TAB was pressed
if (args.get_domEvent().keyCode == 9) {
if (sender.get_highlightedItem()) {
sender.get_highlightedItem().select();
}
}
}
function OnclientFocus(sender, args) {
var input = sender.get_inputDomElement();
sender.highlightAllMatches(input.defaultValue);
sender.showDropDown();
}
</script>
</telerik:RadCodeBlock>
</head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager ID="ScriptManager1" runat="server"
EnablePageMethods="True">
</telerik:RadScriptManager>
<telerik:RadFormDecorator ID="QsfFromDecorator" runat="server"
DecoratedControls="All" Skin="Sunset" />
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="ImgBtnelimina">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadAjaxPaneldelete"
LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="Imgbtnconfermapwd">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadAjaxPanelpwd"
LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="ImgBtninvia">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadAjaxPanelinvito"
LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="ImageButtonRicerca">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="Panel1"
LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="Imgprofile">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadToolTip1"
LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="RadMenu1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadAjaxPanel1"
LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="ImageButtonAggiorna">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadAjaxPanel1"
LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Runat="server"
BorderColor="#D5842B" BorderStyle="Double"
HorizontalAlign="Center" BorderWidth="1px" Skin="Simple">
</telerik:RadAjaxLoadingPanel>
<telerik:RadWindowManager ID="RadWindow_Conferma" runat="server" Modal="True" Skin="Office2010Silver">
<Windows>
<telerik:RadWindow ID="RadWindowProfiledelete" runat="server" Style="z-index: 8000"
ShowContentDuringLoad="false" Width="416px" Height="193px"
Behaviors="None" AutoSize="true"
Modal="True" Behavior="None" Font-Names="Verdana" Font-Size="Small"
OnClientClose="LoadHome" VisibleStatusbar="False" Skin="Office2010Silver"
ReloadOnShow="True" EnableViewState="False" VisibleTitlebar="False">
<ContentTemplate>
<div class="Diveliminaaccount">
<div class="Diveliminaaccount1">
<telerik:RadAjaxPanel ID="RadAjaxPaneldelete" runat="server">
<div id="raddelete">
<table style="width:100%;">
<tr>
<td>
</td>
<td colspan="2">
</td>
<td>
</td>
</tr>
<tr>
<td align="center" colspan="4">
Eliminare il tuo account dagli archivi di Trycontact?</td>
</tr>
<tr>
<td align="center" colspan="4">
</td>
</tr>
<tr>
<td align="center" colspan="2">
<asp:ImageButton ID="ImgBtnelimina" runat="server" ImageUrl="~/Image/Elimina.png" />
</td>
<td align="center" colspan="2">
<asp:ImageButton ID="ImgBtnEsci_3" runat="server" ImageUrl="~/Image/esci1.png" OnClientClick="closeRaddelete();return false;" />
</td>
</tr>
</table>
</div>
<div id="confermadelete" style="display:none">
<table style="width:100%;">
<tr>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td align="center" colspan="2">
Account eliminato con successo.</td>
</tr>
<tr>
<td align="center" colspan="2" class="style1">
</td>
</tr>
<tr>
<td align="center" colspan="2">
<asp:ImageButton ID="ImgBtnEsci_4" runat="server"
ImageUrl="~/Image/esci1.png" OnClientClick="closeRaddelete_redirect();return false;" />
</td>
</tr>
</table>
</div>
</telerik:RadAjaxPanel>
</div>
</div>
</ContentTemplate>
</telerik:RadWindow>
<telerik:RadWindow ID="RadWindowLoadprofile" runat="server"
ShowContentDuringLoad="false" Width="410px" Height="210px" Style="z-index: 8000"
Behaviors="None" Modal="True" AutoSize="true" OnClientClose="Loadimage"
Behavior="None" Font-Names="Verdana" Font-Size="Small"
Skin="Office2010Silver" ReloadOnShow="false" VisibleStatusbar="False"
RestrictionZoneID="NavigateUrlZone" EnableViewState="False"
NavigateUrl="UploadImgProfile.aspx" VisibleTitlebar="False">
</telerik:RadWindow>
<telerik:RadWindow ID="RadWindowLoadcard" runat="server" Style="z-index: 8000"
ShowContentDuringLoad="false" Width="400px" Height="430px"
Behaviors="None" AutoSize="true"
Modal="True" Behavior="None"
Font-Names="Verdana" Font-Size="Small"
VisibleStatusbar="False" Skin="Office2010Silver" ReloadOnShow="False"
NavigateUrl="UploadImgCard.aspx" EnableViewState="False"
VisibleTitlebar="False">
</telerik:RadWindow>
<telerik:RadWindow ID="RadWindowChangepwd" runat="server"
ShowContentDuringLoad="false" Width="360px" Style="z-index: 8000"
Height="220px" Behaviors="None" Modal="True"
Behavior="None" ReloadOnShow="True" AutoSize="true"
Font-Names="Verdana" Font-Size="Small" VisibleStatusbar="False"
Skin="Office2010Silver" EnableViewState="False" VisibleTitlebar="False">
<ContentTemplate>
<div class="Divchangepwd">
<div class="Divchangepwd1">
<telerik:RadAjaxPanel ID="RadAjaxPanelpwd" runat="server">
<table style="width:100%;">
<tr>
<td colspan="2" style="padding-left: 10px; padding-top: 10px">
<telerik:RadTextBox ID="Txtpwdnow" Runat="server" Label=" Password attuale:"
LabelWidth="110px" MaxLength="20" TextMode="Password" Width="300px">
</telerik:RadTextBox>
</td>
</tr>
<tr>
<td colspan="2" style="padding-left: 10px">
<telerik:RadTextBox ID="Txtpwdnew" Runat="server" Label="Nuova password:"
LabelWidth="110px" MaxLength="20" TextMode="Password" Width="300px">
</telerik:RadTextBox>
</td>
</tr>
<tr>
<td colspan="2" style="padding-left: 10px">
<telerik:RadTextBox ID="Txtpwdnewconf" Runat="server"
Label="Conferma password:" LabelWidth="110px" MaxLength="20"
TextMode="Password" Width="300px" AutoPostBack="False">
</telerik:RadTextBox>
</td>
</tr>
<tr>
<td colspan="2" style="padding-left: 10px; padding-top:15px">
</td>
</tr>
<tr>
<td align="center">
<asp:ImageButton ID="Imgbtnconfermapwd" runat="server" ImageUrl="~/Image/conferma.png" OnClientClick="return CallNotification()" />
</td>
<td align="center">
<asp:ImageButton ID="ImgBtnEscipwd" runat="server" ImageUrl="~/Image/esci1.png" OnClientClick="closeRadchangepwd(); return false" />
</td>
</tr>
</table>
</telerik:RadAjaxPanel>
</div>
</div>
</ContentTemplate>
</telerik:RadWindow>
<telerik:RadWindow ID="RadWindowAnteprimaCard" runat="server"
ShowContentDuringLoad="false" Behaviors="None" Style="z-index: 8000"
Modal="True" Behavior="None" Font-Names="Verdana" Font-Size="Small"
Width="395px" Height="395px"
ToolTip="Anteprima sfondo" VisibleStatusbar="False" Skin="Simple"
ReloadOnShow="True" NavigateUrl="viewimagecard.aspx"
EnableViewState="False" VisibleTitlebar="False">
</telerik:RadWindow>
<telerik:RadWindow ID="RadWindowinvito" runat="server" Style="z-index: 8000"
ShowContentDuringLoad="false" Behaviors="Close" AutoSize="true"
Modal="True" Behavior="None" Font-Names="Verdana" Font-Size="Small" ReloadOnShow="false"
Width="415px" Height="240px"
VisibleStatusbar="False" Skin="Office2010Silver"
EnableViewState="False" InitialBehaviors="Close"
VisibleTitlebar="False">
<ContentTemplate>
<div class="invito">
<div class="invitobox">
<telerik:RadAjaxPanel ID="RadAjaxPanelinvito" runat="server"
Width="380px" HorizontalAlign="NotSet">
<table style="width:100%;">
<tr>
<td colspan="2" style="padding-bottom:5px">
<asp:Label ID="Label2" runat="server"
Text="Inserire nome e cognome o azienda del destinatario"></asp:Label>
</td>
</tr>
<tr>
<td colspan="2" style="padding-bottom:5px">
<telerik:RadTextBox ID="Txt_utente" Runat="server"
EmptyMessage="Nome e cognome o azienda" LabelWidth="148px" Skin=""
Width="370px" Font-Italic="True" Font-Names="Verdana" Height="22px"
style="font-size: small">
<EmptyMessageStyle Font-Italic="True" Font-Names="Verdana" ForeColor="Gray" />
<HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
</telerik:RadTextBox>
</td>
</tr>
<tr>
<td colspan="2" style="padding-bottom:5px">
<asp:Label ID="Label1" runat="server" Text="Inserisci l'email del destinatario"></asp:Label>
</td>
</tr>
<tr>
<td colspan="2" style="padding-bottom:7px">
<telerik:RadTextBox ID="Txt_email" Runat="server" EmptyMessage="email"
LabelWidth="64px" Skin="" Width="370px" Font-Italic="True" Font-Names="Verdana" Height="22px"
style="font-size: small">
<EmptyMessageStyle Font-Italic="True" Font-Names="Verdana" ForeColor="Gray" />
<HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
</telerik:RadTextBox>
</td>
</tr>
<tr>
<td style="text-align:center">
<asp:ImageButton ID="ImgBtninvia" runat="server"
ImageUrl="~/Image/invia.png" />
</td>
<td style="text-align:center">
<asp:ImageButton ID="ImgBtnEsci" runat="server" ImageUrl="~/Image/esci1.png" />
</td>
</tr>
</table>
</telerik:RadAjaxPanel>
</div>
</div>
</ContentTemplate>
</telerik:RadWindow>
</Windows>
</telerik:RadWindowManager>
<asp:HiddenField ID="contenitoredati" runat="server" />
<asp:HiddenField ID="contenitoreimage" runat="server" />
<div class="backgrounduprecovery">
<div class="profilebody">
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Width="1024px"
HorizontalAlign="NotSet">
<div style="padding-left:200px;">
<div class="profilesearch">
<asp:Panel ID="Panel1" runat="server" DefaultButton="ImageButtonRicerca" Height="55px">
<table style="width:600px; padding-top:6px">
<tr>
<td style="width: 360px; margin: 0px; border: 0px; padding: 0px; text-align: right;">
<telerik:RadTextBox ID="Txt_ricerca1" Runat="server"
EmptyMessage="Nominativo o azienda o categoria" Font-Italic="True"
Font-Names="Verdana" Height="23px" LabelWidth="120px" Skin="" Width="350px">
<EmptyMessageStyle Font-Italic="True" Font-Names="Verdana" ForeColor="Gray" />
<HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
</telerik:RadTextBox>
</td>
<td style="width: 260px; margin: 0px; border: 0px; padding: 0px; text-align: left;">
<telerik:RadTextBox ID="txt_ricerca2" Runat="server"
EmptyMessage="Città di residenza" Font-Italic="True" Font-Names="Verdana"
Height="23px" Skin="" Width="250px">
<EmptyMessageStyle Font-Italic="True" Font-Names="Verdana" ForeColor="Gray" />
<HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
</telerik:RadTextBox>
</td>
<td style="width: 80px; margin: 0px; border: 0px; padding: 0px;">
<asp:ImageButton ID="ImageButtonRicerca" runat="server"
ImageUrl="~/Image/search.png" Width="48px" ToolTip="Cerca" />
</td>
</tr>
</table>
</asp:Panel>
</div>
</div>
<div class="separatorcard">
<div class="separatormenu">
<div class="profilemenu">
<table style="width:100%;">
<tr>
<td>
<div style="float:left; padding-top: 6px">
<table style="width: 100%;">
<tr>
<td>
<div style="padding-bottom:5px">
<table style="width: 100%">
<tr>
<td align="center">
<div>
<asp:Image ID="Imgprofile" runat="server" ImageUrl="~/Image/avatar.png" Height="128px" Width="128px" CssClass="Imgprofilesmall100"/>
</div>
</td>
</tr>
</table>
</div>
<div class="DivMenuLeft">
<telerik:RadMenu ID="RadMenu1" Runat="server" EnableRoundedCorners="True"
OnItemClick="RadMenu1_ItemClick"
EnableShadows="True" Skin="Office2010Silver"
style="top: 0px; left: 0px" Flow="Vertical">
<Items>
<telerik:RadMenuItem runat="server" Font-Names="Verdana" Font-Size="Small"
Text="Gestione sfondo biglietto">
<Items>
<telerik:RadMenuItem runat="server" Font-Names="Verdana"
ImageUrl="~/Image/Icone/new.png" Owner="" Text="Nuovo sfondo" Value="3"
Width="180px">
</telerik:RadMenuItem>
<telerik:RadMenuItem runat="server" Font-Names="Verdana"
ImageUrl="~/Image/Icone/delete.png" Owner="" Text="Elimina sfondo" Value="4"
Width="180px">
</telerik:RadMenuItem>
</Items>
</telerik:RadMenuItem>
<telerik:RadMenuItem runat="server" IsSeparator="True" Text="Root RadMenuItem4">
</telerik:RadMenuItem>
<telerik:RadMenuItem runat="server" Font-Names="Verdana" Font-Size="Small"
Text="I miei preferiti" Enabled="False">
</telerik:RadMenuItem>
<telerik:RadMenuItem runat="server" IsSeparator="True" Owner="RadMenu1"
Text="Root RadMenuItem13">
</telerik:RadMenuItem>
<telerik:RadMenuItem runat="server" Font-Names="Verdana"
Font-Size="Small" Owner="RadMenu1" Text="Invita un amico">
</telerik:RadMenuItem>
<telerik:RadMenuItem runat="server" IsSeparator="True"
Text="Root RadMenuItem6">
</telerik:RadMenuItem>
<telerik:RadMenuItem runat="server" Font-Names="Verdana" Font-Size="Small"
Text="Modifica password">
</telerik:RadMenuItem>
<telerik:RadMenuItem runat="server" IsSeparator="True" Text="Root RadMenuItem8"
Owner="RadMenu1">
</telerik:RadMenuItem>
<telerik:RadMenuItem runat="server" Font-Names="Verdana" Font-Size="Small"
Text="Elimina account" Owner="RadMenu1">
</telerik:RadMenuItem>
<telerik:RadMenuItem runat="server" IsSeparator="True"
Text="Root RadMenuItem10">
</telerik:RadMenuItem>
<telerik:RadMenuItem runat="server" Font-Names="Verdana" Font-Size="Small"
Text="Esci da Trycontact">
</telerik:RadMenuItem>
</Items>
<ExpandAnimation Type="OutBack" />
</telerik:RadMenu>
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</div>
<div class="profilecard">
<div style="width:750px; float:left; padding:2px">
<asp:Panel ID="Panel2" runat="server" DefaultButton="ImageButtonAggiorna"
Height="492px">
<table style="width:100%;">
<tr>
<td style="text-align:left; ">
<table style="width:605">
<tr>
<td style="width:603px">
<div style="width:350px; float:left; height:23px; padding-right:2px">
<telerik:RadTextBox ID="Utente" Runat="server" EmptyMessage="Nome e cognome o azienda/società"
Font-Italic="True" Font-Names="Verdana" Height="23px" LabelWidth="140px"
MaxLength="100" Skin="" Width="350px">
<EmptyMessageStyle Font-Italic="True" Font-Names="Verdana" ForeColor="Gray" />
<HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
</telerik:RadTextBox>
</div>
<div id="PasswordMask1" style= "width: 250px; float:right; height:23px">
<telerik:RadTextBox ID="Radpasswordhide1" Runat="server" EmptyMessage="Password (max. 20 caratteri)"
MaxLength="20" Width="250px" Height="23px" ClientEvents-OnFocus="OnFocus1"
SelectionOnFocus="SelectAll" Skin="" Font-Italic="True"
Font-Names="Verdana" LabelWidth="100px">
<ClientEvents OnFocus="OnFocus1" />
<EmptyMessageStyle ForeColor="Gray" Font-Italic="True" Font-Names="Verdana" />
<HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
</telerik:RadTextBox>
</div>
<div id="Password1" style="display:none; width: 250px; float:right; height:23px">
<telerik:RadTextBox ID="Radpassword1" runat="server" TextMode="Password"
ClientEvents-OnBlur="OnBlur1" MaxLength="20" Width="250px" Height="23px"
SelectionOnFocus="SelectAll" Skin="" >
<ClientEvents OnBlur="OnBlur1" />
<EmptyMessageStyle ForeColor="Gray" Font-Italic="True" Font-Names="Verdana" />
<HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
</telerik:RadTextBox>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="padding-bottom:10px">
</td>
</tr>
<tr>
<td style="text-align:left">
<table style="width:100%; border:0px; margin:0px; padding-top:5px">
<tr>
<td style="width:350px; padding-left:2px">
<div>
<telerik:RadComboBox ID="Categoria" Runat="server" DropDownWidth="350px" Height="175px"
EmptyMessage="Seleziona la tua categoria" EnableLoadOnDemand="True"
EnableVirtualScrolling="True" LoadingMessage="Caricamento..."
ShowMoreResultsBox="True" Filter="Contains" MarkFirstMatch="true"
MaxHeight="175px" Skin="Sunset" Width="350px" EnableItemCaching="True"
Font-Italic="True" Font-Names="Verdana" OnClientKeyPressing="KeyPressing">
<WebServiceSettings Path="WebService.asmx" Method="GetCategoryNames" />
</telerik:RadComboBox>
</div>
<div id="spec" style="padding-top:3px; height:23px">
<telerik:RadTextBox ID="specializzazione" Runat="server"
EmptyMessage="Inserisci la tua specializzazione o classificazione"
Font-Italic="True" Font-Names="Verdana" Height="23px" MaxLength="100" Skin=""
Width="600px">
<EmptyMessageStyle Font-Italic="True" Font-Names="Verdana" ForeColor="Gray" />
<HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
</telerik:RadTextBox>
</div>
<div id="clas" style="padding-top:3px; height:23px; display:none">
<telerik:RadComboBox ID="Radclassificazione" Runat="server" Culture="it-IT"
EmptyMessage="Classificazione" Height="120px" Width="120px" Filter="StartsWith"
Skin="Sunset" Font-Italic="True" Font-Names="Verdana"
LoadingMessage="Caricamento...">
<Items>
<telerik:RadComboBoxItem runat="server" Text="1 stella" Value="1"/>
<telerik:RadComboBoxItem runat="server" Text="2 stelle" Value="2"/>
<telerik:RadComboBoxItem runat="server" Text="3 stelle" Value="3"/>
<telerik:RadComboBoxItem runat="server" Text="4 stelle" Value="4"/>
<telerik:RadComboBoxItem runat="server" Text="5 stelle" Value="5"/>
<telerik:RadComboBoxItem runat="server" Text="5 stelle lusso" Value="6"/>
</Items>
</telerik:RadComboBox>
</div>
<div style="width:350px; height:22px; padding-top:3px">
<div style="width:287px; float:left; padding-right:2px">
<telerik:RadComboBox ID="Comune" Runat="server" DropDownWidth="287px"
EmptyMessage="Seleziona la tua città" EnableLoadOnDemand="True"
Height="175px" MaxHeight="175px" EnableVirtualScrolling="True"
LoadingMessage="Caricamento..." ShowMoreResultsBox="True" Filter="Contains" MarkFirstMatch="true"
Skin="Sunset" Width="287px" EnableItemCaching="True" MinFilterLength="0"
Font-Italic="True" Font-Names="Verdana" OnClientKeyPressing="KeyPressing">
<WebServiceSettings Method="GetCityNames" Path="WebService.asmx" />
</telerik:RadComboBox>
</div>
<div style="width:60px; float:right">
<telerik:RadTextBox ID="Cap" Runat="server" EmptyMessage="C.a.p."
Font-Italic="True" Font-Names="Verdana" Height="23px" MaxLength="5" Skin=""
Width="60px" FocusedStyle-HorizontalAlign="Center">
<EmptyMessageStyle Font-Italic="True" Font-Names="Verdana" ForeColor="Gray" />
<HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
</telerik:RadTextBox>
</div>
</div>
<div style="width:350px; height:22px; padding-top:3px">
<telerik:RadTextBox ID="Indirizzo" Runat="server" Width="350" MaxLength="50"
Skin="" Height="23px" Font-Italic="True" Font-Names="Verdana"
EmptyMessage="Indirizzo e numero civico">
<EmptyMessageStyle ForeColor="Gray" Font-Italic="True" Font-Names="Verdana" />
<HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
</telerik:RadTextBox>
</div>
<div class="div0">
<div class="div1">
<telerik:RadTextBox ID="Telefono" Runat="server" EmptyMessage="Telefono"
Font-Italic="True" Font-Names="Verdana" Height="23px" MaxLength="15" Skin=""
Width="173px">
<EmptyMessageStyle Font-Italic="True" Font-Names="Verdana" ForeColor="Gray" />
<HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
</telerik:RadTextBox>
</div>
<div class="div2">
<telerik:RadTextBox ID="Fax" Runat="server" EmptyMessage="Fax"
Font-Italic="True" Font-Names="Verdana" Height="23px" MaxLength="15" Skin=""
Width="173px">
<EmptyMessageStyle Font-Italic="True" Font-Names="Verdana" ForeColor="Gray" />
<HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
</telerik:RadTextBox>
</div>
<div class="div3">
<telerik:RadTextBox ID="Cellulare" Runat="server" EmptyMessage="Cellulare"
Font-Italic="True" Font-Names="Verdana" Height="23px" MaxLength="15" Skin=""
Width="173px">
<EmptyMessageStyle Font-Italic="True" Font-Names="Verdana" ForeColor="Gray" />
<HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
</telerik:RadTextBox>
</div>
</div>
<div class="divref">
<div class="divref0">
<telerik:RadTextBox ID="Referente" Runat="server" MaxLength="30" Width="350px"
Skin="" Height="23px" Font-Italic="True" Font-Names="Verdana"
EmptyMessage="Referente azienda">
<EmptyMessageStyle ForeColor="Gray" Font-Italic="True" Font-Names="Verdana" />
<HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
</telerik:RadTextBox>
</div>
</div>
<div class="divsocial">
<div class="divfec">
<telerik:RadTextBox ID="Facebook" Runat="server" MaxLength="100" Width="261px"
Skin="" Height="23px" Font-Italic="True" Font-Names="Verdana"
EmptyMessage="Facebook">
<EmptyMessageStyle ForeColor="Gray" Font-Italic="True" Font-Names="Verdana" />
<HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
</telerik:RadTextBox>
</div>
<div class="divtwi">
<telerik:RadTextBox ID="Twitter" Runat="server" MaxLength="100" Width="261px"
Skin="" Height="23px" Font-Italic="True" Font-Names="Verdana"
EmptyMessage="Twitter">
<EmptyMessageStyle ForeColor="Gray" Font-Italic="True" Font-Names="Verdana" />
<HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
</telerik:RadTextBox>
</div>
</div>
<div class="divsocial">
<div class="divgoo">
<telerik:RadTextBox ID="Google" Runat="server" MaxLength="30" Width="261px"
Skin="" Height="23px" Font-Italic="True" Font-Names="Verdana"
EmptyMessage="Google+">
<EmptyMessageStyle ForeColor="Gray" Font-Italic="True" Font-Names="Verdana" />
<HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
</telerik:RadTextBox>
</div>
<div class="divlin">
<telerik:RadTextBox ID="Linkedin" Runat="server" MaxLength="50" Width="261px"
Skin="" Height="23px" Font-Italic="True" Font-Names="Verdana"
EmptyMessage="Linkedin">
<EmptyMessageStyle ForeColor="Gray" Font-Italic="True" Font-Names="Verdana" />
<HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
</telerik:RadTextBox>
</div>
</div>
<div class="divsocial">
<div class="divsky">
<telerik:RadTextBox ID="Skype" Runat="server" MaxLength="30" Width="261px"
Skin="" Height="23px" Font-Italic="True" Font-Names="Verdana"
EmptyMessage="Skype">
<EmptyMessageStyle ForeColor="Gray" Font-Italic="True" Font-Names="Verdana" />
<HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
</telerik:RadTextBox>
</div>
<div class="divmsn">
<telerik:RadTextBox ID="Messenger" Runat="server" MaxLength="30" Width="261px"
Skin="" Height="23px" Font-Italic="True" Font-Names="Verdana"
EmptyMessage="Messenger">
<EmptyMessageStyle ForeColor="Gray" Font-Italic="True" Font-Names="Verdana" />
<HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
</telerik:RadTextBox>
</div>
</div>
<div class="divsite">
<div class="divmail">
<telerik:RadTextBox ID="Email" Runat="server" MaxLength="50" Width="320px"
Skin="" Height="23px" Font-Italic="True" Font-Names="Verdana"
EmptyMessage="Indirizzo email">
<EmptyMessageStyle ForeColor="Gray" Font-Italic="True" Font-Names="Verdana" />
<HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
</telerik:RadTextBox>
</div>
<div class="divweb">
<telerik:RadTextBox ID="Website" Runat="server" MaxLength="50" Width="280px"
Skin="" Height="23px" Font-Italic="True" Font-Names="Verdana"
EmptyMessage="Sito web">
<EmptyMessageStyle ForeColor="Gray" Font-Italic="True" Font-Names="Verdana" />
<HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
</telerik:RadTextBox>
</div>
</div>
<div class="divnote">
<div class="divtnote0">
<telerik:RadTextBox ID="Note" Runat="server" MaxLength="500" Width="735px"
Height="100px" TextMode="MultiLine" Skin="" Font-Italic="True"
Font-Names="Verdana"
EmptyMessage="Inserisci notizie varie su di te o sull'attività che svolgi"
Rows="10">
<EmptyMessageStyle ForeColor="Gray" Font-Italic="True" Font-Names="Verdana" />
<HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
</telerik:RadTextBox>
</div>
<div class="divbutton">
<asp:ImageButton ID="ImageButtonAggiorna" runat="server" ImageUrl="~/Image/conferma.png" OnClick="ImageButtonAggiorna_Click"/>
</div>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</asp:Panel>
</div>
</div>
</div>
</telerik:RadAjaxPanel>
</div>
<telerik:RadNotification ID="RadNotification1" runat="server"
AutoCloseDelay="3500" Height="100px" Skin="Office2010Silver" Title="Trycontact"
TitleIcon="~/Image/iconlogo.png" Width="400px" Position="Center">
</telerik:RadNotification>
</div>
</form>
</body>
</html>

this is vb net code:

Private Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
    If Not IsPostBack Then
        If contenitoredati.Value = "no" Then
            Carica_profilo_finale(CInt(Session.Item("idutente")))
            button.ID = "btnload"
            button.Text = "load photo"
            button.Skin = "Office2010Silver"
            AddHandler button.Click, AddressOf button_Click
            button.Icon.PrimaryIconCssClass = "rbAdd"
 
            Dim tip As New RadToolTip()
            tip.ID = "RadTooltip1"
            tip.Controls.Add(button)
            RadAjaxPanel1.Controls.Add(tip)
            tip.TargetControlID = "Imgprofile"
            tip.Width = Unit.Pixel(120)
            tip.Height = Unit.Pixel(30)
            tip.RelativeTo = ToolTipRelativeDisplay.Element
            tip.Position = ToolTipPosition.MiddleRight
            tip.HideEvent = ToolTipHideEvent.ManualClose
            tip.Skin = "Telerik"
            tip.Show()
        End If
    End If
End Sub
 
Protected Sub button_Click(sender As Object, e As EventArgs)
    Dim script As String = "function f(){$find(""" + RadWindowLoadprofile.ClientID + """).show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"
    ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "key", script, True)
End Sub
0
Fabio Cirillo
Top achievements
Rank 1
answered on 02 Apr 2013, 09:36 AM
I understand why it does not work ... I put the code in the if Not IsPostBack if I put the code out from this statement it works fine. But now I have to manage the display of tooltips in an if .. then why the tooltip should appear only if the profile picture is not loaded. to see if the image is not loaded I run the control in this section of code:
Dim listaUtente As List(Of PropertyUtente) = LoadProfile.Carica_profilo(idutente)
For Each Item In listaUtente
Utente.Text = Item.utente
Categoria.SelectedValue = Item.idcategoria
Categoria.Text = Item.Desccategoria
Comune.SelectedValue = Item.Desccomune & ";" & Item.Descprovincia & ";" & Item.Descregione
Comune.Text = Item.Desccomune
Indirizzo.Text = Item.Indirizzo
Cap.Text = Item.Cap
Telefono.Text = Item.Telefono
Fax.Text = Item.Fax
Cellulare.Text = Item.Cellulare
Email.Text = Item.Email
contenitoredati.Value = Item.Password
Website.Text = Item.Website
Note.Text = Item.Note
Facebook.Text = Item.Facebook
Twitter.Text = Item.Twitter
Skype.Text = Item.Skype
Google.Text = Item.Google
If Item.Imageprofile = "" Then
REM here i must the code to see the tooltip
Else
Imgprofile.ImageUrl = Item.Imageprofile
End If
Next
0
Danail Vasilev
Telerik team
answered on 04 Apr 2013, 03:06 PM
Hello Fabio,

You can use the show() method of the RadToolTip in the if statement, in order to display the tooltip. For example:
If Item.Imageprofile = "" Then
    tip.Show()
End If
You can also find useful the server-side API of the RadToolTip.

Regards,
Danail Vasilev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Button
Asked by
Fabio Cirillo
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Fabio Cirillo
Top achievements
Rank 1
Share this question
or