TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ejaz mirza
NA
471
47.2k
insert and edit the data using treeview control in mvc
Jun 29 2018 7:42 AM
public
ActionResult chartofaccountscreate()
{
// ViewBag.accountname = new SelectList(mse.chartofaccounts, "AccountName", "AccountName");
treeviewlist();
return
View();
}
[HttpPost]
public
ActionResult chartofaccountspost(FormCollection col)
{
chartofaccount coa =
new
chartofaccount();
UpdateModel(coa);
treeviewlist();
if
(ModelState.IsValid)
{
mse.chartofaccounts.Add(coa);
mse.SaveChanges();
}
return
View(
"chartofaccountscreate"
);
}
public
void
treeviewlist()
{
List<chartofaccount> all =
new
List<chartofaccount>();
using
(mastersEntities dc =
new
mastersEntities())
{
all = dc.chartofaccounts.OrderBy(a => a.AccountName).ToList();
}
ViewBag.accountname = all;
}
public
ActionResult chartofaccountedit(String name)
{
treeviewlist();
chartofaccount data=
null
;
if
(name ==
null
) {
return
View(
"chartofaccountscreate"
);
}
else
{
data = mse.chartofaccounts.SingleOrDefault(x => x.AccountName == name);
int
aid=data.ID;
return
View(
"chartofaccountscreate"
, data);
}
}
<
input
type
=
"input"
class
=
"form-control"
id
=
"input-select-node"
placeholder
=
"Identify node..."
value
=
"Parent 1"
style
=
"margin-left:50px"
>
<
script
>
$(function () {
$("#edit").click("change", (function () {
search
= $('#input-select-node').val();
$.ajax({
type: 'GET',
url: '/chartofaccounts/chartofaccountedit{id}',
contentType: "application/json;
charset
=
utf
-8",
data: { name: search},
cache: false,
success: function (data) {
alert(success);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert("data not found" + textStatus + errorThrown);
}
});
}));
});
</
script
>
am returning the selected node data to the view when i return the data controller to view it shows the error that data not foud i have the data
Reply
Answers (
0
)
Hi guys is there any scope for Test driven development ? ?
Reset password asp.net 4.5