Monday, 2 September 2013

AspxComboxbox Client Side Events and Client Side Properties

1. How to get the Text of combobox in clientside javascript
===========================================================

Aspx Page Code
===============
<dx :ASPxComboBox ID="cmbExample1" ClientInstanceName="cmbExample" runat="server">
</dx: ASPxComboBox>

<asp:button Id="btnTest" Text="Show Text" OnClientClick="ShowComboText(); return false;" runat="server" >

Note: here "cmbExample" is the clientinstance name of the combobox control.

Javascript:
===========

function ShowComboText()
    var comboText= cmbExample.GetText(); 
  alert(comboText); 
}  

2. How to get the value of the combobox in clientside javascript
================================================================

 <asp:button Id="btnTest" Text="Show Value" OnClientClick="ShowComboValue(); return false;" runat="server" >

Note: here "cmbExample" is the clientinstance name of the combobox control.

Javascript:
===========

function ShowComboValue()
    var comboval= cmbExample.GetValue(); 
   alert(comboval);  
}  
                                    
3. How to find the item from combobox in clientside javascript
================================================================

 <asp:button Id="btnTest" Text="Show Item" OnClientClick="ShowFoundedItemByVal(); return false;" runat="server" >

Note: here "cmbExample" is the clientinstance name of the combobox control.

Javascript:
===========

function ShowFoundedItemByVal()
{  
    var comboitem= cmbExample.FindItemByValue('your value');
  alert(comboitem);  
}  

function ShowFoundedItemByText()
      var comboitem= cmbExample.FindItemByText('your value')
    alert(comboitem);   
}  
                                

4. How to remove from combobox in clientside javascript
================================================================

 <asp:button Id="btnTest" Text="Remove Item" OnClientClick="RemoveItem(); return false;" runat="server" >

Note: here "cmbExample" is the clientinstance name of the combobox control.

Javascript:
===========

function RemoveItem()
    var comboitem= cmbExample.FindItemByValue('your value')

 if (comboitem != undefined && comboitem != null
  {
         cmbExample.RemoveItem(comboitem.index);
          
   }
}  

1 comment:

How to Send Email from Python

Please find the below sample code to send email from Python. import os import smtplib from email.mime.multipart import MIMEMultipart...