7473 1
Validate Coupon code in asp.net by Calling WebMethod using javascript or jQuery

I need help to calculate resulted amount after applying coupon code, the thing is when user enter the coupon code, it can be of two type 0/1, suppose this is the table

Voucher Code

Amount

Off_type

Test

50

0

Demo

10

1

Now if the Off_type is 1, then Amount to be deducted should be as rupees, and if Off_type 0, then amount to be deducted should be percent of total.

For example: If total amount(without discount) is 100, and Coupon code is "Demo", then after discount total amount to be paid will be 90, as 100 - 10% Of (Total) =90

So I am not able to implement this functionality using jQuery and WebMethod, here is my current code

jQuery

...
Type
Question
7365 0
Convert PDF to HTML using C# in ASP.NET MVC
In this example, I have explained how you can convert PDF to HTML using C# and pdftohtml.exe in ASP.NET MVC
Type
Article
7361 1
How to create N Level Of TreeView from database in asp.net

Hello Guys !!

I have already asked the same question but now I am again asking with the new requirement, so please read carefully and solve my issues.

 My Requirement:

  •    How to create n level of Treeview in asp.net c# from SQL Database Record.

Explaining my Requirement

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="N-level-Treeview.aspx.cs"
Inherits="N_level_Treeview" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TreeView ID="TreeView1" runat="server" ImageSet="XPFileExplorer" NodeIndent="15">
<HoverNodeStyle Font-Underline="True" ForeColor="#6666AA" />
<NodeStyle Font-Names="Tahoma" Font-Size="8pt" ForeColor="Black" HorizontalPadding="2px"
NodeSpacing="0px" VerticalPadding="2px"></NodeStyle>
<ParentNodeStyle Font-Bold="False" />
<SelectedNodeStyle BackColor="#B5B5B5" Font-Underline="False" HorizontalPadding="0px"
VerticalPadding="0px" />
</asp:TreeView>
</div>
</form>
</body>
</html>?

: -  I have a table and there are Srno,PId, Pname, CID, CName,Cqty columns in my table.

Suppose if CID is also in PID column,  Node must be created on that CID and also must have expand button to show the child of that cID.

What i have done in coding let's see...

CS--------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
public partial class N_level_Treeview : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataTable dt = this.GetData("SELECT cId, cName FROM TopBill");
this.PopulateTreeView(dt, 0, null);
}
}
 
private void PopulateTreeView(DataTable dtParent, int parentId, TreeNode treeNode)
{
foreach (DataRow row in dtParent.Rows)
{
TreeNode child = new TreeNode
{
Text = row["cName"].ToString(),
Value = row["cId"].ToString()
};
if (parentId == 0)
{
TreeView1.Nodes.Add(child);
DataTable dtChild = this.GetData("SELECT srNo,cid, cName FROM TopBill WHERE pid = " + child.Value);
PopulateTreeView(dtChild, int.Parse(child.Value), child);
}
else
{
treeNode.ChildNodes.Add(child);
}
}
}
 
private DataTable GetData(string query)
{
DataTable dt = new DataTable();
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand(query))
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.CommandType = CommandType.Text;
cmd.Connection = con;
sda.SelectCommand = cmd;
sda.Fill(dt);
}
}
return dt;
}
}
}

-------------- Current Output of my Code is ...

...

Type
Question
7336 0
Redirect from non-www to www website using IIS (and Vice-Versa)
In this article, we will see how we can redirect from non-www website to www website url using IIS URL re-write feature or using web.config.
Type
Article
7288 0
Save Selected Dropdown and Text value in database in ASP.NET Web-Forms
In this article, I have provided step by step procedure to create dropdown from database and add new dropdown values in database in ASP.NET Web-Forms.
Type
Article

7259 0
Send mail in ASP.NET (Web-Form using C#)
In this article, I have provided sample code to send email in asp.net web form using C# code, i have also provided code to send email with attachment in ASP.NET
Type
Article
7252 1
No parameterless constructor defined for this object.

Hi, i am getting this issue while running a page in MVC, it was working fine previously, but i now i am getting the error as below

...
Type
Question
7202 1
How to Edit data using pop-up modal in knockout js and MVC?

How can I edit/update value using pop-up modal in knockout js and MVC?

My data is being displayed in a table using knockout but when the user clicks on edit button, text boxes, values should prefill with data in pop up model against particular id, but I am not able to achieve this.

...
Type
Question
7201 1
How to create Dropdown list using Option group in MVC Razor?

How to create Dropdown list using Option group in MVC Razor syntax in View, like below iimage

...

Type
Question
7171 2
How to create shopping cart in asp.net MVC?

I have to create shopping cart in Asp.net MVC ,i don't know from where I should start

As i am a beginner, I saw various Youtube videos online but i am not able understand coding in those videos, so Please give me some other appropriate recommendation or advise??? 

Thanks

...
Type
Question

Page 15 of 31