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
Zeineb Mhiri
NA
17
1.4k
Searching clients from database table
Apr 15 2017 11:35 AM
Hello i have a problem with button search in c#, it is not working (on web application).
here is my code in my controller "ClientController.cs":
public ActionResult GetAllClientDetails(string searchBy, string search)
{
ClientRepository ClientRepo = new ClientRepository();
ModelState.Clear();
if (searchBy == "Numero_compte")
{ return View(ClientRepo.GetAllClients().Where(X => X.Numero_compte == search).ToList()); }
else
{
return View(ClientRepo.GetAllClients().Where(X => X.Nom.StartsWith(search)).ToList());
}
}
and in my view which i called "GetAllClientDetails.cshtml":
@using (Html.BeginForm("GetAllClientDetails","Client",FormMethod.Get))
{
Serach By :
@Html.RadioButton("searchBy", "Numero_compte", true)
Numero_compte
@Html.RadioButton("searchBy", "Nom")
Nom
@Html.TextBox("Search")
}
I really can't understand what's the problem ... Help please.
Reply
Answers (
2
)
Dropdownlist selected value not saved into database
Is IDisposable interface just used for standardization ?