|
In a vb.net 2010 web form application, I have a request from the user to be able to insert,update, and/or delete a row
in a single table. Thus I have the following questions to ask:
1. I am trying to decide if I should use a detailsviews, formview, gridview, and/or a different control for this purpose.
Thus would you tell me what control you would recommend and why you would recommend that particular control?
2. For the different options for insert, update, and delete, would I use the buttons that are on the control that you
recommend? If not would I use, new buttons that I place on the webform page?
3. For the control that you recommend that I use, should I place the sql 'embedded' in the sqldatasource, the control
you recommend and/or access the sql from a different location(vb.net code in a new location)?
Would you tell me , show me with pictures, and/or point to me to links (urls) that will show me how to accomplish
this
|
|
|
|
|
The traditional way of solving this is using a master/detail scenario:
1. Drag a gridview to the site, and bind it to the database's table. Rightclick it and choose to have a Select field shown.
2. Drag a details view to the page, and bind it as well. In its bidning window, you can graphically set a WHERE statement. Set your statement to Control, then chose your gridview as the control. Also click the advanced button to enable DELETE, UPDATE, and INSERT.
If done right, this means that when a user clicks the Select button for a particular row in the gridview, this row's data will appear in the detailsview. Then it can be updated or deleted, and more data can be inserted from the detailsview.
I don't know how much you know about binding to a database, but be sure you stay out of SQL injection trouble.
Note that searching for master/detail, gridview and detailsview you should be able to fond a lot of info on how to do this.
Good luck!
|
|
|
|
|
Hi,
I am new to ADFS SSO implementation via SAML 2.0.Could you please guide any one to accomplish below requirement.
I have requirement to implement single sign on using ADFS,once you click on sign in through adfs button it should create saml request like mydomainname/adfs/ls/?SAMLRequest="" then it will redirect to ADFS login page then after successfully validation adfs should send response to our consumer page which our back end code will validate the response if it is valid then proceed further.
It is urgent requirement.quick response will help my day simpler.It will great if some one shared related link to follow.
Thanks for your help in advanced.
Regards,
Prasanna
|
|
|
|
|
|
Hello. I have a side panel that is layed out like this:
<div class="panel panel-default">
<div class="panel-heading">
<h4>To Do</h4>
</div>
<ul class="list-group">
<asp:Repeater runat="server" ID="rptToDo">
<ItemTemplate>
<li class="list-group-item"><a href="Landing.aspx?Don=<%# Eval("ID") %>">X</a> <a href="Details.aspx?ID=<%# Eval("ID") %>"><%# Eval("ItemName") %></a></li>
</ItemTemplate>
</asp:Repeater>
<li class="list-group-item">
<asp:Panel runat="server" DefaultButton="btnAddToDo">
<input type="text" runat="server" id="txtAddToDo" class="form-control" placeholder="Add Item" />
<asp:Button runat="server" ID="btnAddToDo" Style="visibility: hidden;" OnClick="btnAddToDo_Click"></asp:Button>
</asp:Panel>
</li>
</ul>
</div>
Instead of having that text box at the bottom to add new records to, I'd like to put a good button or link of some sort to the right of my title , but still inside the gray area. I can't quite seem to get it to line up. Any help would be greatly appreciated.
|
|
|
|
|
It's looks like your using bootstrap with webforms. I haven't seen anybody do that yet. Interesting.
You would have to divide the title using the row and grid that bootstrap provides, because grids can only be childs of row.
<div class="panel-heading">
<div class="row">
<div class="col-sm-8">
<h4>To Do</h4>
</div>
<div class="col-sm-4">
<button class="btn btn-primary" type="button">Add +</button>
</div>
</div>
</div>
|
|
|
|
|
Hi All,
As per our client request, I am going to convert our MVC 4 application into ASP.Net core. What are all the common development and deployment difficulties that may occur during conversion process? Please provide your valuable suggestions on this.
Best Regards,
Simiyon A
modified 12-Jul-16 5:09am.
|
|
|
|
|
I gave it a shot over a month ago. Core is way different.
I think you have to use VS2015 to do core, and add the DotNetCore Development Kit to it.
Then you can open a new core project. I wasn't able to upgrade a project to core, but had to start a new project and build it piece by piece. I found that most of my classes were not compatible with core and had to be partially rewritten.
Plus you have to add Docker, so you can test the core and run it. Docker can be Mac, Linux and Windows based, doesn't matter.
After that, you just post the core to a server with Docker, and off you go!
I ended up postponing core development, to finish my project first, and then go to core. Maybe next year.
It's the way to go, but too much for me to chew on one time. I just adopted Node.js and Gulp, plus Sass for CSS and Bootstrap so I have my hands full at the moment.
|
|
|
|
|
I have an MSChart control on a web form that displays numerous line graphs. But I am unable to apply a text annotation. Nothing works thus far. I tried to add with VS 2013 community in both the designer and run-time code. Nothing shows up. But no errors are shown, either. Any suggestions?
Nothing from Microsoft was helpful. Or elsewhere in my search, although I noted lots of difficulties with this control.
|
|
|
|
|
what you want to do exactly with text annotation, MSCHART support shape, text, group annotation, which one you want to use ?
try with following simple snippet, see if it works
using System.Web.UI.DataVisualization.Charting;
...
LineAnnotation myLine = new LineAnnotation();
myLine.Name = "myLine";
myLine.X = 3;
myLine.Y = 3;
Chart1.Annotations.Add(myLine);
Find More .Net development tips at : .NET Tips
The only reason people get lost in thought is because it's unfamiliar territory.
|
|
|
|
|
i have class User and my object have id
user.ID = 555
the user model have property
[ForeignKey("ID")]
public virtual IList<post> PostNames { get; set; }
i have class post :
public int IdUser { get; set; }
[ForeignKey("IdUser")]
public virtual User users { get; set; }
i get user.PostName - count = 0
and i know i have something in my database in post table.
What am I doing wrong ??
|
|
|
|
|
user.PostName - count = 0
Simple question. How can you substract a number from a string.
?????
|
|
|
|
|
Since you're using attributed mapping, you need to declare the type that you're mapping to. Your Post class is correct, but you need to change:
[ForeignKey("ID")]
public virtual IList PostNames { get; set; }
to
[ForeignKey("ID")]
public virtual ICollection<Post> PostNames { get; set; }
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
I am planning to automate a website (which is used to file tax). I think it is better to implement using asp.net. I am new to website automation. My questions are as follows,
1. How to make user to fill details in my asp page (User will enter details in my local server , and I will send those details to main website)
2. How to make user to enter captcha by showing him only image from main website in local page and later I will send that value to main website?
3. How to control child window from main window and vise versa using asp.net ?.
|
|
|
|
|
srikrishnathanthri wrote: How to make user to fill details in my asp page (User will enter details in my local server , and I will send those details to main website)
For this when user fills the details,you can make an HTTP POST to your main website.In this ,you can parse the parameters in your main website via an http post from your button click event handler when one clicks on the button after entering the details.
Here is a link
c# - HTTP request with post - Stack Overflow[^]
|
|
|
|
|
hi
I do not know where is going wrong but i seems not able to insert data using web api. Any help greatly appreciated and thanks a lot
The data
{"ID":1,"EmailAddress":"demo@demo.com"}
and the code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using Dapper;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
namespace cirqer.Controllers.api
{
public class EmailListList
{
public int ID { get; set; }
public string EmailAddress { get; set; }
}
public class emaillistController : ApiController
{
static string connectionstring = ConfigurationManager.ConnectionStrings["CRConnectionString"].ConnectionString;
[HttpGet]
public Int16 EmailList_SelectCount()
{
try
{
using (var conn = new SqlConnection(connectionstring))
{
Int16 x = conn.ExecuteScalar<short>("EmailList_SelectCount", commandType: CommandType.StoredProcedure);
return x;
}
}
catch
{
return 0;
}
}
[HttpPost]
public void EmailList_Insert(EmailListList email)
{
try
{
// dynamic data = email;
using (var conn = new SqlConnection(connectionstring))
{
conn.Open();
conn.Execute("EmailList_Insert", email, commandType: CommandType.StoredProcedure);
conn.Close();
}
}
catch
{
}
}
}
}
|
|
|
|
|
Hello,
I have a form in which users can select "yes-full time", "yes-part time", "No" or "Retired"
In the code behind, I am trying to turn off validation for three textboxes and one radiobuttonlist if the user selects "No" or "Retired"
|
|
|
|
|
What is your question?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hello,
Thanks for the quick reply.
I am trying to have three textboxes and one radiobuttonlist have its requiredfieldvalidators disabled based on a previous radiobuttonlist.
My code behind is as follows:
------------
protected void rbCurrentlyEmployed_SelectedIndexChanged(object sender, EventArgs e)
{
if (rbCurrentlyEmployed.SelectedValue == "No" || rbCurrentlyEmployed.SelectedValue == "Retired" )
((RequiredFieldValidator)txtEmployer.FindControl("RFV_Employment_Employer")).Enabled = false;
((RequiredFieldValidator)txtJobTitle.FindControl("RFV_Employment_JobTitle")).Enabled = false;
((RequiredFieldValidator)txtWorkPhone.FindControl("RFV_Employment_WorkPhone")).Enabled = false;
((RequiredFieldValidator)rbgrantsmatchingfunds.FindControl("RFV_Employment_MatchingFunds")).Enabled = false;
else
{
((RequiredFieldValidator)txtEmployer.FindControl("RFV_Employment_Employer")).Enabled = true;
((RequiredFieldValidator)txtJobTitle.FindControl("RFV_Employment_JobTitle")).Enabled = true;
((RequiredFieldValidator)txtWorkPhone.FindControl("RFV_Employment_WorkPhone")).Enabled = true;
((RequiredFieldValidator)rbgrantsmatchingfunds.FindControl("RFV_Employment_MatchingFunds")).Enabled = true;
}
}
-----------------
I seem to be getting an error in the syntax of the 'else' statement.
ANY help would be greatly appreciated
|
|
|
|
|
You're missing the braces around the content of the if branch. As a result, only the first statement is considered part of the if branch - as if you had written:
if (rbCurrentlyEmployed.SelectedValue == "No" || rbCurrentlyEmployed.SelectedValue == "Retired" )
{
((RequiredFieldValidator)txtEmployer.FindControl("RFV_Employment_Employer")).Enabled = false;
}
((RequiredFieldValidator)txtJobTitle.FindControl("RFV_Employment_JobTitle")).Enabled = false;
((RequiredFieldValidator)txtWorkPhone.FindControl("RFV_Employment_WorkPhone")).Enabled = false;
((RequiredFieldValidator)rbgrantsmatchingfunds.FindControl("RFV_Employment_MatchingFunds")).Enabled = false;
else
{
((RequiredFieldValidator)txtEmployer.FindControl("RFV_Employment_Employer")).Enabled = true;
((RequiredFieldValidator)txtJobTitle.FindControl("RFV_Employment_JobTitle")).Enabled = true;
((RequiredFieldValidator)txtWorkPhone.FindControl("RFV_Employment_WorkPhone")).Enabled = true;
((RequiredFieldValidator)rbgrantsmatchingfunds.FindControl("RFV_Employment_MatchingFunds")).Enabled = true;
}
Add the braces, and the syntax error will go away:
if (rbCurrentlyEmployed.SelectedValue == "No" || rbCurrentlyEmployed.SelectedValue == "Retired" )
{
((RequiredFieldValidator)txtEmployer.FindControl("RFV_Employment_Employer")).Enabled = false;
((RequiredFieldValidator)txtJobTitle.FindControl("RFV_Employment_JobTitle")).Enabled = false;
((RequiredFieldValidator)txtWorkPhone.FindControl("RFV_Employment_WorkPhone")).Enabled = false;
((RequiredFieldValidator)rbgrantsmatchingfunds.FindControl("RFV_Employment_MatchingFunds")).Enabled = false;
}
else
{
((RequiredFieldValidator)txtEmployer.FindControl("RFV_Employment_Employer")).Enabled = true;
((RequiredFieldValidator)txtJobTitle.FindControl("RFV_Employment_JobTitle")).Enabled = true;
((RequiredFieldValidator)txtWorkPhone.FindControl("RFV_Employment_WorkPhone")).Enabled = true;
((RequiredFieldValidator)rbgrantsmatchingfunds.FindControl("RFV_Employment_MatchingFunds")).Enabled = true;
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard,
Thank you for the quick reply.
I added the curly brackets as you suggested but I still get an error msg on the 'else' statement
My code behind is as follows now:
--------------
protected void rbCurrentlyEmployed_SelectedIndexChanged(object sender, EventArgs e)
{
if (rbCurrentlyEmployed.SelectedValue == "No" || rbCurrentlyEmployed.SelectedValue == "Retired" )
((RequiredFieldValidator)txtEmployer.FindControl("RFV_Employment_Employer")).Enabled = false;
((RequiredFieldValidator)txtJobTitle.FindControl("RFV_Employment_JobTitle")).Enabled = false;
((RequiredFieldValidator)txtWorkPhone.FindControl("RFV_Employment_WorkPhone")).Enabled = false;
((RequiredFieldValidator)rbgrantsmatchingfunds.FindControl("RFV_Employment_MatchingFunds")).Enabled = false;
}
else
{
((RequiredFieldValidator)txtEmployer.FindControl("RFV_Employment_Employer")).Enabled = true;
((RequiredFieldValidator)txtJobTitle.FindControl("RFV_Employment_JobTitle")).Enabled = true;
((RequiredFieldValidator)txtWorkPhone.FindControl("RFV_Employment_WorkPhone")).Enabled = true;
((RequiredFieldValidator)rbgrantsmatchingfunds.FindControl("RFV_Employment_MatchingFunds")).Enabled = true;
}
--------------------
After the textboxes, Visual Studio 12 indicates that the textboxes are a 'field' and are being used as a 'type'
ANY help would be greatly appreciated...
|
|
|
|
|
You are still missing the opening brace after the if statement. Use proper indentation of your code and it will become obvious.
|
|
|
|
|
Hi All,
I have three Action methods on in a Controller in ASP.Net MVC application and I have one cshtml page, cshtml page is using an AngularJS controller which in turn calls 2nd action method.
First Action method calls the View that is cshtml page that cshtml page calls the AngularJS controller which executes second Action method to get the data onto the cshtml page.
Data refreshing is working upto this.
Now the 3rd Action method which is inserting data into the database, when it is calling the first action method then the AngularJS code on the cshtml file is not executing to call the 2nd action method in the Controller.
Here is my View code (this part not refreshing so that I can have the latest data that's added)
@using MVCWithWebApiApp.Models;
@using System.Linq;
@model IEnumerable<MVCWithWebApiApp.Models.User>
@{
ViewBag.Title = "Users List";
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Users List</title>
<script src="~/Scripts/jquery-2.2.4.min.js"></script>
<script src="~/Scripts/angular.min.js"></script>
<script src="~/Scripts/myApp.js"></script>
</head>
<body><br />
<div data-ng-app="myApp" data-ng-controller="userController">
<table style="border:none 0px gray;">
<tr>
<td>
<table style="border:solid 1px gray;">
<tr>
<td style="border:solid 1px gray;">User Id</td>
<td style="border:solid 1px gray;">User Name</td><br />
</tr>
<tr data-ng-repeat="usr in users">
<td><a href="/User/UpdateUser/{{usr.UserId}}"> {{usr.UserId}} </a> </td>
<td><a href="/User/UpdateUser/{{usr.UserId}}">{{usr.UserName}}</a></td><br />
</tr>
</table>
<pre>
</td>
<td>
@Html.ActionLink("Create User", "CreateUser")
</td>
</tr>
</table>
</body>
</html>
Here is my Controller code:
using MVCWithWebApiApp.Models;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace MVCWithWebApiApp.Controllers
{
public class UserController : Controller
{
public ActionResult Index()
{
var dbContext = new MVCDBContext();
List<User> listOfUsers;
listOfUsers = dbContext.Users.ToList();
return View(listOfUsers);
}
public ActionResult GetUsers()
{
var dbContext = new MVCDBContext();
List<User> listOfUsers;
listOfUsers = dbContext.Users.ToList();
return Json(listOfUsers, JsonRequestBehavior.AllowGet);
}
public ActionResult CreateUser()
{<br />
return View();
}
[HttpPost]
public ActionResult CreateUser(FormCollection collection)
{
try
{
string Id = Request.Form["UserId"];
string UserName = Request.Form["UserName"];
int UserId;
var dbContext = new MVCDBContext();
User user = new User();
user.UserId = (int.TryParse(Id, out UserId) ? UserId : 0);
user.UserName = UserName;
dbContext.Users.Add(user);
dbContext.SaveChanges();
return RedirectToAction("Index");
}
catch
{
return View();
}
}
}
}
My Model is:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
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; }
}
}
}
And the .js file of the AngularJS code
var myApp = angular.module('myApp', []);
myApp.controller('userController', ['$scope', '$http', function ($scope, $http) {
$scope.users = "";
$http.get("/User/GetUsers")
.success(function (result) {
$scope.users = result;
})
.error(function (result) {
console.log(result);
});
}]);
Any help is going to be very very helpful thanks
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Are you getting any error in your .error {} in Angular. Did you check the console.
While debugging it doesn't hit the GetUsers action?
|
|
|
|
|
Hi,
Yes its giving me error but as below, can it help me please?
GET http:
And very interesting that the refresh is happening in Chrome browser but not in IE, how can I solve that type of problem?
Thanks buddy.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|