|
|
Are you asking us to design and develop the code. ?????????
|
|
|
|
|
Create a Web Forms application using a user interface similar to the one shown below. However feel free to modify the layout to allow for better usability, if desired.
All server-side code should be in C#
Required Features:
1. Name/Value pairs are to be entered into the upper textbox. This textbox is used for adding and filtering Name/Value pairs.
2. When the ‘Add’ button is pressed the Name/Value pair in the textbox is validated, and then if it passes validation it is added to the listbox below. The Name/Value pair entry format is shown below:
3. <name> = <value>
4. Where <name> is the name portion of the pair, and <value> is the value portion of the pair. Only valid Name/Value pairs can be added. Names and Values can contain only alpha-numeric characters. The equal-sign is used to delimit the pair, spaces before and/or after the equal-sign may be entered as padding at the end-users discretion.
5. When the ‘Sort by Name’ button is pressed the list will be sorted ascending by Name.
6. When the ‘Sort by Value’ button is pressed the list will be sorted ascending by Value.
7. When the ‘Delete’ button is pressed all selected items in the listbox will be deleted.
Optional Features
The following features are a test option and may not be required, please refer to the job description to see if it is a requirement
1. When the ‘Filter’ button is pressed, only the Name/Value pairs that match the filter criteria will be shown in the listbox. The search criteria will be taken from the textbox.
Filters have the following format (and are similar to the Name/Value format):
<type> = <value>
Where <type> is either Name or Value, and <value> is a string used for matching against the given type.
2. When the ‘Clear Filter’ button is pressed all of the Name/Value pairs will be shown in the listbox.
|
|
|
|
|
Well what an adventure after 5 days of trying to figure all this out. But after getting my project up and running, I now see the benefits as a whole, and it was well worth it. Many of the earlier questions I had about MVC have now been answered, such as what's up with the Razor, what is Webgrease and how to use it, and how do we minify our CSS and Script files.
So while we were watching Steve Ballmer try to buy the LA Clippers, the new CEO Satya Nadella has been working to let Microsoft developers have more fun creating apps, by unchaining us from the boiler plated project templates and letting us choose how we want to work.
My 5 day journey in the last week has exposed me to all sorts of new concepts that appear to be working great out there such as Node.js, but I digress, and will return back to the topic.
Bower:
So in case you didn't know, Bower is another way to download packages that can be automated. It's not a replacement for NuGet, which is still viable for server side packages, but the preferred way to download front end frameworks and packages such as Bootstrap and JQuery.
Bower compared to NuGet Packages
The NuGet client packages were sort of lame. I used NuGet for Font Awesome, and a couple of other front end packages, and had to go through all sorts of hoops to get them to work. Many of the packages were broken or outdated. Bower allowed me a very easy way to get the latest version of the package up and running in very little time, and did the dependency checking for me as well.
NPM
NPM is sort of like rpm in linux, that runs off Git, which is the git repository. You can download packages by command line such as npm install uglify -save-dev , which will download the package and save it to a package.json file, to use later.
Gulp
Gulp is a JavaScript file that uses the packages downloaded by NPM to customize your project. So with the package uglify, I can write a gulp command to minify my JQuery script files, add the suffix .min and publish them in my custom location.
Gulp can do many things, you can wrap script tag elements in HTML content and use Gulp to read the HTML, bundle those scripts and uglify them. Build customer CSS from Sass sources and minify them. So take for example JQuery 3.0 was released today, I think I'll just change the version number in my package.json and upgrade my project today, for it runs automatically.
Running Build and Clean
Put it all together, bind it to your project's pre-build, post-build and clean events, and you have a very powerful solution that is easy to work on and maintain.
VS2013 - Stripping MVC almost to the bare bones
Yes I had to strip my projects Nuget packages to the bare bones and figure out how to replace the functionality that Microsoft had injected into my project. What a mind bender as to what did those packages did in the first place? Microsoft was quite clever and had the intentions of producing the best possible results for an entry level MVC programmer, but I wanted more infinite control over how my project would be published for production use.
Razor
Well I just got my head out of the sand and realized that I don't have to use Razor. There are many other solutions out there such as Angular.js which actually looks more functional to me. But I have already started with Razor and will try Angular.js in my next project.
Deployment using Docker on Linux or Windows
I had no idea that Docker was out there. Docker is a container that includes a small version of your operating system and your production project. It's not a Virtual Machines, but the concept is similar. So you can develop in your Docker container, and just deploy the container to a cloud service or in house server. This eliminates the headaches that have long plagued us, in which hey it works in development but not in production.
And it doesn't have to be a Windows OS, you can develop on a Linux platform using the new Microsoft ASP.Net for Linux and Mono I believe. Build your Linux platform in Docker, and just deploy that Docker container to a Windows or Linux server running Docker.
Final thoughts
I'm really excited about this today. Makes me want to upgrade to Windows 10 and VS2015 to start using Dockers. I'd love to go back to Linux for serving my apps, and other open source programs and database servers.
I'm very happy with my current project right now! and see infinite possibilities with it today. I love the MVC platform and I'm not going back.
I wrote this because I still see the old webforms questions about Gridview, binding data to server controls, etc. And with all due respect, I think Code Project can use an upgrade in thread topics to cover these wonderful new technologies, and lead the way for all of us to benefit from them. I'd like to see some discussion on Node.js, and TypeScript.
I have many programmer friends that think MVC is sort of dumb, it's like classic ASP so whats the point? And I remember reading an earlier question as to why I should switch to MVC. So I hope this post provides a more convincing argument as to why MVC over webforms.
You guys and gals have a great weekend!
|
|
|
|
|
Thanks for sharing. I like the idea of creating something specific to new technologies for Code Lab where we can all experiment and discuss new topics
|
|
|
|
|
Thanks for the thumbs up John!
I went ahead and upgraded to Windows 10 from 8.1 and VS2015 from 2013 last Sunday.
I didn't know you can turn off almost all the BS in Win 10, and just run it straight.
It doesn't see all my ram, just half of the 32 gigs.
And the VS2015 is awesome, It has a JQuery and JavaScript lint checker that works very well.
My project is really cool now. When I publish, I can minify or ugligy all my Css, scripts, images to the production server, yet work with them raw in development for debugging.
So now on to the Sass, I need to learn that fast so I can create individual Sass files instead of Css and concat and minify them efficiently.
I guess I'm on my own now here with the new stuff. Perhaps others will read this post and jump on board.
I do like your thoughts on a place to talk about new stuff and the results were getting from it.
|
|
|
|
|
Hi
If you don't mind can you put some steps for each (Gulp , Sass, NPM) on how to install them and work on it. I am aware that I can get them online by googling but it will be more assuring if it is from someone we can check back.
|
|
|
|
|
Sure, give me a couple of days to compose an article instead of just posting here.
Thanks!
|
|
|
|
|
|
i am fresher in asp .net .i designed a website for visitors management system in asp.net.
i need to print details in a tag. how to code it.please help me
|
|
|
|
|
Which tag you want to print detail and what you do so far ?
|
|
|
|
|
just like vistor name
purpose-
reporting time and etc with webcam photo
|
|
|
|
|
Hello,
I want to add data into grid.mvc which is placed in the partialview. This data should be inserted into grid as soon as data entry in the form happens. Finally on the click of a button, grid data should be uniquely get saved in table.
Please help me.
Thanks,
|
|
|
|
|
dshilpa wrote: Please help me With what? All you have given us is a want list. You need to explain exactly what you are having a problem with.
|
|
|
|
|
I am storing data in viewdata[] . After that, store it into the grid. 'SetDataBinding' functionality of datagrid view in tranditional ASP..NET should be implemented. How it can be done?
Refreshing grid view periodically?
Is there any attribute of grid mvc to be set there?
|
|
|
|
|
what have you tried so far? what's the problem you are facing?
You have to explain with more details. Do you want to save them into DB table?
|
|
|
|
|
Need Help about PDF document opened in iframe using ASP.Net MVC
My requirement is to provide a facility in my application to open a PDF document in editable format, user will edit and sign the PDF fields and submit it back. I load the document in iFrame and now i want to get all the fields in the PDF form on submit click. Can u please help me
My VIEW code is as below
<form id="frmPDF" enctype="multipart/form-data" method="post" action="@Url.Action("SavePDF", "Home")" target="_blank">
<iframe type='application/pdf' name='PDFObj' id='PDFObj' src="@Url.Action("GetPDF", "Home")" style="width: 100%; height: 625px;" ></iframe>
<input type="submit" value="Submit PDF" />
<input type="hidden" name="hid" value="safd" />
</form>
<script>
$(document).ready(function() {
$('form').on("submit", function (event) {
var form = $(this);
var iframe = document.getElementById('PDFObj');
var iframeDocument = [iframe.contentDocument || iframe.contentWindow.document];
var pluginData = iframeDocument;
$(form).append('<input type="file" name="PDFInput" id="PDFInput" value="' + pluginData + '" style="visibility:hidden"/>');
form.submit();
});
});
</script>
And my Controller Code is:
public ActionResult GetPDF()
{
return File("~/Content/newDocument.pdf", "application/pdf");
}
[HttpPost]
public ActionResult SavePDF()
{
var hid = Request["hid"];
HttpPostedFileBase file = Request.Files[0];
if (file != null && file.ContentLength > 0)
{
var fileName = Path.GetFileName(file.FileName);
var path = Path.Combine(Server.MapPath("~/App_Data"), fileName);
file.SaveAs(path);
}
return View("Index");
}
|
|
|
|
|
I am having a column of image in gridview .Used jquery table sorter for sorting .don't know how to sort this column please help me
<asp:boundfield datafield="ContactName" headertext="ContactName" itemstyle-cssclass="contactName"
="" itemstyle-width="17%">
<asp:boundfield datafield="ContactEmail" headertext="ContactEmail" itemstyle-cssclass="contactEmail"
="" itemstyle-width="21%" visible="false">
<asp:templatefield headertext="ContactEmail">
<itemstyle width="21%" horizontalalign="Center">
<itemtemplate>
<asp:hiddenfield id="hdn1" runat="server" value="<%#Eval("ContactEmail") %>">
here is my code i want to sort the image column is there any solution please help me
|
|
|
|
|
Hi All,
I am trying to write a Code First Approach which is using Entity Framework and Web Api. When I run the application first time its not creating a new database instead giving me the following error.
The model backing the 'MVCDBContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http:
Here is my Controller
namespace MVCWithWebApiApp.Controllers
{
public class UserController : Controller
{
public ActionResult Index()
{
var dbContext = new MVCDBContext();
List<User> listOfEmployees;
listOfEmployees = dbContext.Users.ToList();
return Json(listOfEmployees, JsonRequestBehavior.AllowGet);
}
public ActionResult Details(int id)
{
return View();
}
public ActionResult Create()
{
return View();
}
[HttpPost]
public ActionResult Create(FormCollection collection)
{
try
{
return RedirectToAction("Index");
}
catch
{
return View();
}
}
public ActionResult Edit(int id)
{
return View();
}
[HttpPost]
public ActionResult Edit(int id, FormCollection collection)
{
try
{
return RedirectToAction("Index");
}
catch
{
return View();
}
}
public ActionResult Delete(int id)
{
return View();
}
[HttpPost]
public ActionResult Delete(int id, FormCollection collection)
{
try
{
return RedirectToAction("Index");
}
catch
{
return View();
}
}
}
}
And here is my Db Context
namespace MVCWithWebApiApp.Models
{
public class MVCDBContext : DbContext
{
public DbSet<User> Users { get; set; }
}
}
And here is my Model
namespace MVCWithWebApiApp.Models
{
public class User
{
private int _userId;
public int UserId
{
get { return _userId; }
set { _userId = value; }
}
private string _userName;
public string UserName
{
get { return _userName; }
set { _userName = value; }
}
}
}
When I am trying to call the as "" "[^]
Then it is hitting the break point in the Action method "public ActionResult Index()"
But giving me the error as I mentioned above
My Connection string in Web Config is:
<add name="MVCDBContext" providerName="System.Data.SqlClient" connectionString="Data Source=KNW-DEL-ABDUL\SQL2008R2;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False"/>
Please help me how to generate a database on the back-end using Code First approach.
And I have another question since I am new to Code First Approach, how can I update changes on the database without losing already existing data. Means I am thinking in Code First once the database is created then how can implement new schema changes etc on database without effecting the existing data? Do I need to drop the whole Database again and recreate it and then do data migration. Isn't that difficult. And that too when I run my application for several times is it going to create database those many of times?
These are also my questions. But the above 1st question is very important as I am not able to create the database itself first.
Thanks in advance.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
|
Database creation is done in the DBContext after declaring the class. You can tell the DBContext to drop the old database when the Model has changed, or create a new database if there is no database.
You also call an intializer to seed the database with data or images, etc.
So this DBContext will call my initializer:
It will either create a new database, or run a database migration.
public class indigoDBContext : DbContext
{
public indigoDBContext() : base("DefaultConnection")
{
Database.SetInitializer(new indigoIntializer());
}
public DbSet<CRM_ARCHIVES> CRM_ARCHIVES { get; set; }
This is my intializer.
class indigoIntializer : CreateDatabaseIfNotExists<indigoDBContext>
{
protected override void Seed(indigoDBContext context)
{
base.Seed(context);
siteAdministrators.seed(context);
countries.seed(context);
states_Provinces.seed(context);
salesTax.seed(context);
avatars.seed(context);
themes.seed(context);
paymentGateways.seed(context);
paymentBrands.seed(context);
}
}
class Configuration : DbMigrationsConfiguration<indigoDBContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = true;
ContextKey = "Indigo.DataAccessLayer.indigoDBContext";
}
protected override void Seed(Indigo.DataAccessLayer.indigoDBContext context)
{
base.Seed(context);
siteAdministrators.seed(context);
countries.seed(context);
states_Provinces.seed(context);
salesTax.seed(context);
avatars.seed(context);
themes.seed(context);
paymentGateways.seed(context);
paymentBrands.seed(context);
}
}
So when you change the database model, you have to either delete the database and start again or run a migration in package manager (command line) within Visual Studio, migrations add update_today for an example, then migration save .
update_today would be a code function in the DBContext that's sort of like a seed command, in which it uses code to change the database table to the new version.
I prefer to delete the database and start all over again. This ensures that my seed functions work well, the setup programs work when starting from scratch. Then when complete of ready for release, use migration and version control and keep existing data.
All of this runs automatically as soon as you make a DBcontext. The migrations you run manually, unless I can figure out how to run them using npm in the build event.
|
|
|
|
|
|
Google for both terms and do some reading.
|
|
|
|
|
So I'm ready to minify my CSS and Script files. Doing some research for hours, I'm seeing folks are using Gulp and Bower, and not Webgrease. I read the instructions on Bower, but I really don't want to delete by bundles in which I just modified, boostrap, Newtonsoft and everything else and start again.
So I'll try Webgrease first. Questions. What are some of the best practices such as folder structures. I'm using the current folders called Content and Scripts. But in the Webgrease Config XML, there's an input and output folders.
Should I create a new folder for the raw stuff I'm working on, and keep the original folders for the output? Then when I publish the project, the raw folders and output folders copy over? And when I develop, use the output folders.
Or use the same folders, and Webgrease will create a new file adding .min, and then figure out how to use the .min files in production use? I prefer this method, easier to maintain and develop on for me.
Where do you put the webgrease.xml file, in the project root? And then leave the WG.exe in the Visual studio folder, Do I need to map that or something so I call it from my project location?
And this webgrease can run on each project build? Or just call it command line.
In the past, I did this manually, the hard way and spent too much time. Really this is my fist time using any of these tools. Before I write this and start testing, I just wanted to get some feedback on it first. I know they should like dumb questions but not much came back on my searches. Everything was assumed.
Side Rant:
But on a side note or story, I was shopping for brake rotors at R1 Concepts for my car on my phone, and this 1 website consumed 160 megs of my monthly plan within 30 minutes. All the scripts were on the webpage and not separate files, and placed everywhere and not on the bottom. My iphone 6S+ with it's speedy CPU took 5 minutes to load the page compared to my desktop with 6 core Xeon that took 13 seconds. Talk about an example of what not to do.
So this is important to me now, and I would like to automate the task as I continue writing more CSS and JQuery.
modified 6-Jun-16 12:20pm.
|
|
|
|
|
I updated my VS2013 to support Task Runner, Package Intellisense, Grunt Laucher.
Then I updated my project to use Bower, Gulp, Node.js, Git and Npm.
So I'm going to dump the Web Grease, Bundle, and Anti3R? and go this new direction. Dump my optimization, Twitter Boostrap, JQuery, font-awesome NuGet packages then reload the those packages in this new format.
Exactly what I did not want to do. But now I see the benefits of it in the long run.
|
|
|
|
|