7704 0
Upload file to Google Drive using Service Account in C# MVC (With Impersonation)
In this article, I have explained how we can upload file to google drive using service account, using domain wide delegation and impersonation in ASP.NET MVC.
Type
Article
7703 0
Using Chart in ASP.NET (Pie chart in ASP.NET)
In this article, I have explained and provided example to create dynamic pie chart in asp.net using database data and asp.net chart control.
Type
Article
7640 2
Populating DropDownList with values showing error There is no ViewData item of type IEnumerable SelectListItem that has the key Name

I Have populated the DropDownList with the roles from the AspNetRoles, when I am registering a new user and allocating a role an error is thown

"There is no ViewData item of type 'IEnumerable<SelectListItem>' that has the key 'Name'."

My AccountController :

...
Type
Question
7460 2
How to ignore files while committing code on GitHub using Visual Studio?

Hello, I am using Visual Studio and I was constantly adding "/bin/projectname.dll" files on GitHub until now, but now I want to ignore these .dll files. So How can I ignore these build files and push only files like .cs, .html,.js ,.css etc to GitHub Repository.

...
Type
Question
7366 0
Custom Error pages in ASP.NET MVC
In this article, I have explained how you can show custom errors in ASP.NET MVC web-application using web.config and Controller settings.
Type
Article

7312 2
How to delete a single Record using Entity Framework?

How can I delete (remove) single record from database table using entity framework in asp.net MVC Controller?

please note I want to delete row of selected Id from the database permanently(Not to make a column IsActive and set it as false)

...
Type
Question
7234 2
Error: Requires either publish_to_groups permission and app being installed in the group, or manage_pages and publish_pages.. when posting on facebook pages using Graph API explorer

Hi, I want to test if I can post from my app under facebook developer to my page facebook (my manager page) please look below image.

But I have got this error message as shown below

...
Type
Question
7206 1
How to debug in visual studio? ( Tutorial to debug C# code )
In this article, I have explained how you can debug your code in visual studio, line by line and make developer life easier using visual studio debugging tool.
Type
Article
7192 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
7116 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

Page 14 of 31