|
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.
|
|
|
|
|
Hi All,
i want to show Google map with multiple marked locations with detail on each marked.
Tools: ASP.net web form, C# with ADO.net and SQL sever 2008.
i want to get Latitude and Longitude from database and show marker on google map dynamically.
|
|
|
|
|
As mentioned on your cross-post, this is not an actual question. Asking someone to give you all the code you need is quite rude. Please search google, there are many examples of how to do this. When you get stuck implementing an example then please come back and ask a new question and post the relevant code and where you are stuck.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hello,
I am trying to make an ASP.NET application that uploads a file to a server on a domain.
When I provide my username and password to the application, I can upload but, I need to use credentials who uses the web application that time.
I am using HttpWebRequest object and tried CredentialCache.DefaultCredentials but it didn't work.
Because of security rules in my company, I have to exclude passwords in my app. How do I get NetworkCredentials of the current user?
I couldn't find any solutions? Please help.
Thanks,
Can DOĞU.
|
|
|
|
|
|
My WebConfig file is like this. There is no difference.
Thanks.
|
|
|
|
|
If your code is impersonating the user and the user is authenticated via Windows Authentication then your code is executing as that user.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
You should be able get the identity using
HttpContext.Current.User.Identity
|
|
|
|
|
The fact that you need to enter credentials (assuming in a pop-up box) shows that basic authentication is being used. As mentioned you need to use Windows Authentication\Impersonation....it varies depending on your version of IIS. It won't work on all browsers\network configurations though so it's hard to know if you just don't have it configured, or if your particular situation doesn't allow it. Google for more info.
|
|
|
|
|
I wrote a diagnostics program for my web app, Submit a Bug Report.
At the time of submission, I call the page in the controller and grab the HTML with the error, sort of a page snap shot. This way I can see what happened such as a unhanded exception, misspelling or whatever the issue is.
So Now on the resolve program, I want to display that HTML. I'm not if I'm over thinking this or not. I do have the page Url to use, which works. But I thought the page from the actual time it happened would be better.
I tried src=""Data: text/Html, charset: utf-8, the html"" but I get the Url of the page, and not the page. I suspect that the render engine is changing it.
I would just be nice to make it happen. I did get the page to size down correctly, maybe that was the hard part.
<div id="snapShot" class="collapse">
<div class="panel-body">
<div class="row">
<div class="col-sm-12">
<div class="form-group">
@Html.LabelFor(m => m.Page_HTML, new { @class = "control-label" })
<div class="iframe">
<iframe id="pageSnapShot" class="iframe" src="@Model.Page_HTML"></iframe>
</div>
@Html.ValidationMessageFor(m => m.Page_HTML)
</div>
</div>
</div>
</div>
modified 2-Jun-16 15:29pm.
|
|
|
|