|
How to filter data in DataTable using like operator ?
|
|
|
|
|
Do you mean filter the records exrtracted from your database?
|
|
|
|
|
|
Hi ,
i have a Fuel table with following fields :
ColumnName:
1.BillNo 2.BillDate 3.Amount 4.EmployeeId
1001 24.02.2015 1000 e101
1002 25.02.2016 586 e102
and also i bind the dropdownlist with employee tale with following fields
1.Employee Id(Selected value)
2.Employee Name(Display Value)
In My View I have DDL_Employee(dropdownlist) ,txt_fuel(textbox)
Now my question is While i am selecting DDL_Employee value(E101) Amount of 1000 will binidng in txt_Fuel
How to do this Task in Asp.Net Mvc, i am familiar with c# windows application, but here i am stuck in asp.net MVC ,
Give Any Suggestion
|
|
|
|
|
You have to use jquery change event on ddl. In the change event call action in your controller and retrieve the value and update it in textbox
|
|
|
|
|
Hi All,
I am storing a file into Database as Image type along with its extention in another column, I am giving a link button when user clicks on that button the file should be able to be downloaded in the same format as it is stored in database that's nothing but the type user has uploaded the file.
Any help is appreciated a code snippet, a link or even a suggestion is appreciated. Thanks you.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
If you store the file as a byte stream then it will download without any changes to its format.
|
|
|
|
|
Sure thank you.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Hello,
I'm a beginner in the whole MVC thing.
I want to do a form where I get the user details by a user-dropdown-list in the same view.
Like, like (select *from users where username) is this possible on the same view and how?
I allready tried the MS tutorial but it doesnt help that much.
I'm Using the Entity framework with Database first.
Thank you
|
|
|
|
|
I need help please programmers, i need help i don't understand smtp.
____________________________________________
protected void Unnamed6_Click(object sender, EventArgs e)
{
MailMessage mailMsg = new MailMessage();
SmtpClient smtp = new SmtpClient();
try
{
mailMsg.From = new MailAddress(Email.Text);
mailMsg.To.Add("admin@mydomain.co.za");
mailMsg.IsBodyHtml = false;
mailMsg.Subject = "Contact Details";
mailMsg.Body = "Contact Details" + "<b>Name:</b>" + names.Text + " <br/> <b>Email - address :</b>" + Email.Text + "<br/> <b>Comments :</b>" + mgs.Text;
mailMsg.Priority = MailPriority.High;
smtp.Host = "localhost";
smtp.Port = 25;
smtp.Credentials = new System.Net.NetworkCredential();
smtp.Timeout = 25000;
smtp.EnableSsl = true;
smtp.Send(mailMsg);
lblStatus.Text = "Thank you. Your contact details and feed back has been submitted.";
}
catch (Exception ex)
{
lblStatus.Text = "Send Email Failed." + ex.Message;
}
}
---------------------------------------------------------------
Here is an output==
Send Email Failed.Failure sending mail.
|
|
|
|
|
smtp.Host = "localhost";
smtp.Port = 25;
Do you have an SMTP server running on your local system? If not then you will not be able to send any mail. Google for "ASP.NET SMTP" and you will find samples that show how to do it correctly.
|
|
|
|
|
@Richardd Thank for your help is brings confident. I did find Email-SMTP on IIS on my computer it running, but the message is not sending.
|
|
|
|
|
I use a tool called SMTP4DEV to catch SMTP messages. If the message makes it to the tool, the fault is not in the code but the configuration of the SMTP server.
Ah don't lean on me man, cause you can't afford the ticket
|
|
|
|
|
Is there a particular reason you are using smtp on your local machine? Use a known working smtp provider from your ISP\webhost\network admin and if the code works using that then the problem is how you've configured your smtp server, so is not a programming question.
|
|
|
|
|
I am working with ASP.NET MVC 4 using Visual Studio 2015 community edition, and IIS 8.. I am beginner in this technology..
I created login page,
In my Login controller (action Index), I put return RedirectToAction("Index", "Home") to redirect the page when users enter correct username and password.. it works when I debug/run it in visual studio environment.. but when I publish it (let say the name is MyPublishedWeb), create application in IIS, and browse it, the URL will look like this: localhost/MyPublishedWeb/Login/Index
The problem is when I login succesfully, it redirects me to localhost/Home/Index, instead of localhost/MyPublishedWeb/Home/Index, and it gives error..
But when I change RedirectToAction() to Redirect(), it work both in Visual Studio environment and IIS..
What do I miss?
Why RedirectToAction() doesn't work in IIS application?
|
|
|
|
|
Without knowing your routes, you can use "/" as the url as it normally defaults to Home/Index
|
|
|
|
|
I writing a project about product management. Now I want scan barcode of a product when I import/export to store. Can you help me?
|
|
|
|
|
|
|
Most scanners are fairly straightforward devices which read a barcode and return a string containing the actual product number. The issue you need to consider is where the scanner will be connected. If you are trying to do this into a website then how will the users get access to the scanner?
|
|
|
|
|
I'm having a hard time finding anything on this on the internet possible because I don't how to word the question properly.
So I'm reading the Chapter on Routing in Professional ASP.NET MVC 5 and on the second page they have a list of requirements for high-quality URLs. One bullet point is that a URL must be hackable, that is the end of the URL can be hacked off and still work. So I am currently adding handling for this into the controllers of a test project but I can't figure out how to do something.
For example, say I have a controller
public class DepartmentController : Controller {}
With a Details action
public ActionResult Details(int? id)
{
}
I did figure out out that by making the parameter nullable, the controller doesn't error when passed a URL like: http://www.somesite.com/Department/Details that is lacking a parameter therefore fulfilling the hackable requirement. My question is on handling it.
All of the examples I can find pretty much mirrors this:
public ActionResult Details(int? id)
{
if (id == null)
{
return RedirectToAction("FourOhFourError", "Errors", null);
}
else
{
{
}
What I would like to know how to do is to return nothing. Is there a way not to return a redirect or is that impossible with an HTTP GET (i.e. the server must return something to the client)?
I found this which, turns out, is the same as returning null:
return new EmptyResult();
but this just redirects the browser to an empty page. Is there a way to not do anything and have the browser stay on the same page or is that not how the HTTP protocol works?
if (Object.DividedByZero == true) { Universe.Implode(); }
|
|
|
|
|
How about returning a specific view?
public ActionResult Details(int? id)
{
if (id == null)
{
return View("EmptyPage");
}
}
That would render the view located in ~/Views/Department/EmptyPage.cshtml
If you wanted to render a view from a different folder, you should be able to pass the app-relative path of the view:
return View("~/Views/Common/EmptyPage.cshtml");
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
What I am trying to figure out is how to not redirect at all. Let me try to expand a bit. From the end user point of view, say they browse to the URL http//:www.somesite.com/Departments/Details/5. Now, for some reason they backspace the '/5' off the end of the URL and hit enter. Is there a way to have their browser stay on the same page without redirecting or is that not possible. Handling the null parameter in the controller and returning a redirect to another page seems to be the only answer unless a session state is introduced which, to me, is defeating the whole purpose of making MVC stateless.
if (Object.DividedByZero == true) { Universe.Implode(); }
|
|
|
|
|
But returning a specific view doesn't redirect. It just displays that view.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
try
return null;
or get the calling url from the request context and redirect to it
|
|
|
|