Click here to Skip to main content
15,879,348 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Hello,
I am beginner in SharePoint 2013.
I have created a simple project in sp2013,In which i added a visual webpart and place 3 controls on ascx page(one button and 2 text boxes).
i want to display the result as a popup or in a message box.
How I can do this.
Posted
Comments
KaushalJB 4-May-15 8:25am    
You want to display which result?
ViipiinTyagi 4-May-15 8:27am    
addition of two values that i have enter in two text boxes

XML
<script language="javascript">
function GetSum() {
    var txt1 = document.getElementById('txt1')
    var txt2 = document.getElementById('txt2')
    var total = txt1.value + txt2.value;
    alert(total);
}
</script>
<asp:TextBox ID="txt1" runat="server" ></asp:TextBox>
<asp:TextBox ID="txt2" runat="server" ></asp:TextBox>
<input type="button" Text="Add" onclick="GetSum()" />
 
Share this answer
 
Comments
ViipiinTyagi 28-Aug-15 1:40am    
But I want that this solution would be done through Server Object Model in .net or as a console application.
Pankit Patel 14-Oct-15 4:48am    
Here's an example (be sure to add a reference to System.Windows.Forms)
using System.Windows.Forms;

class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter Input 1 in Number Only :");
int input1 = Convert.ToInt32(Console.ReadLine());

Console.WriteLine("Enter Input 2 in Number Only :");
int input2 = Convert.ToInt32(Console.ReadLine());

int sum = input1 + input2;
MessageBox.Show(sum.ToString(), "Information");
}
}
using System.Windows.Forms;

class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter Input 1 in Number Only :");
int input1 = Convert.ToInt32(Console.ReadLine());

Console.WriteLine("Enter Input 2 in Number Only :");
int input2 = Convert.ToInt32(Console.ReadLine());

int sum = input1 + input2;
MessageBox.Show(sum.ToString(), "Information");
}
}
 
Share this answer
 
Quote:
Here's an example (be sure to add a reference to System.Windows.Forms)

using System.Windows.Forms;

class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter Input 1 in Number Only :");
int input1 = Convert.ToInt32(Console.ReadLine());

Console.WriteLine("Enter Input 2 in Number Only :");
int input2 = Convert.ToInt32(Console.ReadLine());

int sum = input1 + input2;
MessageBox.Show(sum.ToString(), "Information");
}
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900