|
It's included three times (two different versions) and yes that's a problem, you need to make sure only one version is referenced. Make sure you don't have copies of multiple versions in your scripts folder then try and work out where other duplicate references are coming from.
|
|
|
|
|
I have removed all the duplication, here is how View Source of my page looks like, still I am getting the same error buddy, I am also not understanding what mistake did I do?
<link href="/BSCSecurityAddressBookWeb/Content/bootstrap.css" rel="stylesheet"/>
<link href="/BSCSecurityAddressBookWeb/Content/site.css" rel="stylesheet"/>
<link href="/BSCSecurityAddressBookWeb/Content/AppCss.css" rel="stylesheet"/>
<link href="/BSCSecurityAddressBookWeb/Content/css/CustomStyles.css" rel="stylesheet"/>
<script src="/BSCSecurityAddressBookWeb/Scripts/jquery-1.12.4.js"></script>
<script src="/BSCSecurityAddressBookWeb/Scripts/jquery-2.1.4.js"></script>
<script src="/BSCSecurityAddressBookWeb/Scripts/jquery-ui-1.12.1.js"></script>
<script src="/BSCSecurityAddressBookWeb/Scripts/Shared/Layout.js"></script>
<script src="/BSCSecurityAddressBookWeb/Scripts/Employee/Index.js"></script>
<script src="/BSCSecurityAddressBookWeb/Scripts/Employee/Employee.js"></script>
<script src="/BSCSecurityAddressBookWeb/Scripts/MultiJobChange/Index.js"></script>
<script src="/BSCSecurityAddressBookWeb/Scripts/MultiJobChange/MultiJobChange.js"></script>
<link href="/BSCSecurityAddressBookWeb/Content/bootstrap.css" rel="stylesheet"/>
<link href="/BSCSecurityAddressBookWeb/Content/site.css" rel="stylesheet"/>
<link href="/BSCSecurityAddressBookWeb/Content/AppCss.css" rel="stylesheet"/>
<link href="/BSCSecurityAddressBookWeb/Content/css/CustomStyles.css" rel="stylesheet"/>
<link href="/BSCSecurityAddressBookWeb/Scripts/bootstrap.js" rel="stylesheet"/>
<link href="/BSCSecurityAddressBookWeb/Scripts/respond.js" rel="stylesheet"/>
<link href="/BSCSecurityAddressBookWeb/Scripts/jquery-1.12.4.js" rel="stylesheet"/>
<link href="/BSCSecurityAddressBookWeb/Scripts/jquery-2.1.4.js" rel="stylesheet"/>
<link href="/BSCSecurityAddressBookWeb/Scripts/jquery.validate.js" rel="stylesheet"/>
<link href="/BSCSecurityAddressBookWeb/Scripts/jquery.validate.unobtrusive.js" rel="stylesheet"/>
<script src="/BSCSecurityAddressBookWeb/Content/themes/bsc/jquery-ui.min.css"></script>
<script src="/BSCSecurityAddressBookWeb/Content/themes/bsc/jquery-ui.structure.min.css"></script>
<script src="/BSCSecurityAddressBookWeb/Content/themes/bsc/jquery-ui.theme.min.css"></script>
These are the only scripts that are referenced in my page when I did View Source of my Page.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
-- modified 10-Aug-17 19:51pm.
|
|
|
|
|
You still have two versions of jQuery and you're also linking to your js scripts as stylesheets?
|
|
|
|
|
Hi,
I have fixed all of those files and duplication, it looks like below in View Source of my page, still the error is happening, can you please help me little bit buddy? Am I still doing mistakes my friend?
<link href="/BSCSecurityAddressBookWeb/Content/bootstrap.css" rel="stylesheet"/>
<link href="/BSCSecurityAddressBookWeb/Content/site.css" rel="stylesheet"/>
<link href="/BSCSecurityAddressBookWeb/Content/AppCss.css" rel="stylesheet"/>
<link href="/BSCSecurityAddressBookWeb/Content/css/CustomStyles.css" rel="stylesheet"/>
<script src="/BSCSecurityAddressBookWeb/Scripts/jquery-2.1.4.js"></script>
<script src="/BSCSecurityAddressBookWeb/Scripts/jquery-ui-1.12.1.js"></script>
<script src="/BSCSecurityAddressBookWeb/Scripts/jquery.validate.js"></script>
<script src="/BSCSecurityAddressBookWeb/Scripts/jquery.validate.unobtrusive.js"></script>
<script src="/BSCSecurityAddressBookWeb/Scripts/Shared/Layout.js"></script>
<script src="/BSCSecurityAddressBookWeb/Scripts/Employee/Index.js"></script>
<script src="/BSCSecurityAddressBookWeb/Scripts/Employee/Employee.js"></script>
<script src="/BSCSecurityAddressBookWeb/Scripts/MultiJobChange/Index.js"></script>
<script src="/BSCSecurityAddressBookWeb/Scripts/MultiJobChange/MultiJobChange.js"></script>
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
What I normally do with these issues is try and strip everything right back to identify the issue. So create a new html page with just the jQuery and jQuery UI script references, and just the elements and script involved in the dialog and see if it works. If it does the issue is something somewhere else interfering with the js so you can keep eliminating things from your actual page until the dialog works and the last thing you removed was probably the cause. However if the basic version still doesn't work the issue is more likely your code or includes.
|
|
|
|
|
This is supposed to be simple.
I have a very simple stored proc which selects records based on ID provided by user.
ALTER PROCEDURE [dbo].[sp_getcheck]
@ID int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
If NOT EXISTS(select * from mytable where ID=@ID)
BEGIN
RAISERROR (
'ID number entered %d is invalid',
11,
1,
@ID);
END
END
What we would like to do is have user enter an ID and check to see if it exists on our database.
If yes, user is redirected to a page of his/her choice.
If no, we would like to keep user on same screen with a message that ID number entered Q1254 is invalid.
That error is raised on the stored procedure and we would like C# code to display that message on the screen for the user.
Here is that code:
protected void chk_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(checknumber.Text))
{
SqlConnection Conn = default(SqlConnection);
Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Constr"].ConnectionString);
Conn.Open();
SqlCommand cmd = new SqlCommand("sp_getcheck", Conn);
cmd.Parameters.AddWithValue("@ID", checknumber.Text);
SqlParameter outPutParameter = new SqlParameter();
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
try
{
imgstatus.ImageUrl = "images/Icon_Available.gif";
lblStatus.ForeColor = Color.Green;
var evalue = hequipID.Value;
if (evalue == "1")
{
Response.Redirect("Air.aspx?pageId=1");
}
if (evalue == "2")
{
Response.Redirect("Land.aspx?pageId=2");
}
}
catch (SqlException ex)
{
imgstatus.ImageUrl = "images/NotAvailable.jpg";
lblStatus.ForeColor = Color.Red;
lblStatus.Text = ex.Message;
chk.BackColor = Color.Silver;
System.Threading.Thread.Sleep(2000);
}
}
}
}
en I tried to run the code, I get the following error message:
Procedure or function 'sp_getchech' expects parameter '@ID', which was not supplied
Surely I am doing something wrong.
Any ideas how to resolve this?
Thanks in advance
modified 9-Aug-17 11:47am.
|
|
|
|
|
You haven't set the CommandType property.
I'd also be inclined to make a few changes:
protected void chk_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(checknumber.Text)) return;
int id;
if (!int.TryParse(checknumber.Text, out id))
{
lblStatus.Text = "Please enter a valid ID number to check.";
return;
}
using (var conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["Constr"].ConnectionString))
using (var cmd = new SqlCommand("sp_getcheck", conn))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@ID", id);
try
{
conn.Open();
cmd.ExecuteNonQuery();
var evalue = hequipID.Value;
if (evalue == "1")
{
Response.Redirect("Air.aspx?pageId=1");
}
else if (evalue == "2")
{
Response.Redirect("Land.aspx?pageId=2");
}
else
{
imgstatus.ImageUrl = "~/images/Icon_Available.gif";
lblStatus.ForeColor = Color.Green;
}
}
catch (SqlException ex)
{
imgstatus.ImageUrl = "~/images/NotAvailable.jpg";
lblStatus.ForeColor = Color.Red;
lblStatus.Text = ex.Message;
chk.BackColor = Color.Silver;
System.Threading.Thread.Sleep(2000);
}
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi Richard,
As usual, your solution worked perfectly; it always does.
WOW.
Sorry, I recognized that I left out the commandType but I came to add that but you have already solved it.
Thank you very much.
|
|
|
|
|
Respected All,
Kindly guide us regarding the Databases of MS-SQL-Server.
if we want to create the one application for the 200 colleges for students online registration/Admission.
Then what will we do?
Either create seprate one application and one database for each college
OR create the one application and one database for 400 colleges.
what is best solutions and guide
I shall be really thankfull for your kindness and suggestions.
Thank you
Mamta
Jagadhri
Distt: Yamunanagar
State: Haryana
Mob.No: 9991740135
email: mamtakuk@gmail.com
|
|
|
|
|
Personally I'd create one database and design it such that it can be used with multiple clients.
BTW you shouldn't put your email or mobile number on the net, you're just going to get spammers\scammers contacting you, you should edit your post to remove that info.
|
|
|
|
|
Hi,
I have the following Route Contex:
context.MapRoute(
"Space_default",
"Space/{Value}/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional }
);
And I would like to get {Value} in my controller in the following code:
public class OverviewController : Controller
{
string myValue = (int)RouteData.Values["Value"];
[CourseAccess(CourseId = myValue)]
public ActionResult Index(int CourseId)
{...
I was wondering how can I do that and use that value before my actions.
Thank you.
|
|
|
|
|
You can't use a field or local variable in an attribute. The attribute parameters and properties are compiled into your code, so they can't depend on runtime data.
You'll probably need to look at using a filter attribute: Understanding Action Filters (C#) | Microsoft Docs[^]
public sealed class CourseAccessAttribute : FilterAttribute, IAuthorizationFilter
{
public void OnAuthorization(AuthorizationContext filterContext)
{
int courseId = (int)filterContext.RouteData["Value"];
if (!HasAccessToCourse(filterContext, courseId))
{
filterContext.Result = new HttpUnauthorizedResult();
}
}
private bool HasAccessToCourse(AuthorizationContext filterContext, int courseId)
{
...
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Nice! Thank you!
|
|
|
|
|
Hi,
I am trying to call a Web Api method (/BSCSecurityAddressBookWeb/api/MultiJobChangeApi/Get) when a button clicked, it has to load a new page (MultiJobChange)
(from Employee page to MultiJobChange)
and in MultiJobChange.js file I have written code for calling the Web Api,
MultiJobChange.cshtml page is loading by calling its Controller using the call window.open('/BSCSecurityAddressBookWeb/MultiJobChange/', '_self', false);,
MultiJobChangeController Index method returns View, up loading of the cshtml page its working properly, but the call to /BSCSecurityAddressBookWeb/api/MultiJobChangeApi/Get is not going.
Can anybody please help me in this regards, I am new to MVC, I am able to move to the new Page or Controller from Employee Page as Employee Page (or Controller is starting one) but not able to call the Web Api method from there even though I am seeing all js files loaded in resources in browser debugger, but still the Web Api call is not making through. Any help would be every supportive thanks in advance.
My Code looks as below:
code in MultiJobChange.js file
MultiJobChange = {
loadMultiJobChange: function (employeeID) {
$.get("/BSCSecurityAddressBookWeb/api/MultiJobChangeApi/Get").then(function (data) {
<pre>
var list = $("#ddlEmployees");
var selectedValue = list.val();
list.empty();
$.each(data, function (index, userList) {
$("<option>").attr("value", userList.EmployeeID).text(applicationgroup.LastName).appendTo(list);
});
$("#btnClearList").click(function (event) {
$("#lbxEmployees").empty();
});
$("#btnRemoveEmployee").click(function (event) {
$("#lbxEmployees option:selected").remove();
});
}
};
code in Employee.js file
loadEmployee: function (employeeID) {
$.get("/BSCSecurityAddressBookWeb/api/EmployeeAPI/Get").then(function (data) {
var list = $("#ddlApplicationGroup");
var selectedValue = list.val();
list.empty();
$.each(data.ApplicationGroups, function (index, applicationgroup) {
$("<option>").attr("value", applicationgroup.ApplicationGroupID).text(applicationgroup.ApplicationGroupName).appendTo(list);
});
if ((selectedValue == null) || (selectedValue == undefined)) {
list.prepend("<option value='-1' selected='selected'>Select value</option>");
if ((list[0] != undefined) && (list[0] != null))
list[0].selectedIndex = 0;
}
else {
list.val(selectedValue);
}
var list = $("#ddlReportPack");
var selectedValue = list.val();
list.empty();
$.each(data.ReportPacks, function (index, reportpack) {
$("<option>").attr("value", reportpack.ReportPackID).text(reportpack.ReportPackName).appendTo(list);
});
if ((selectedValue == null) || (selectedValue == undefined)) {
list.prepend("<option value='-1' selected='selected'>Select value</option>");
if ((list[0] != undefined) && (list[0] != null))
list[0].selectedIndex = 0;
}
else {
list.val(selectedValue);
}
});
}
code in Layout.js file
$(function () {
$("#btnEmployee").click(function (event) {
Employee.loadEmployee();
window.open('/BSCSecurityAddressBookWeb/Employee/', '_self', false);
});
$("#btnMultiJobChange").click(function (event) {
MultiJobChange.loadMultiJobChange();
window.open('/BSCSecurityAddressBookWeb/MultiJobChange/', '_self', false);
});
});
Code in MultiJobChange/Index.js file
function LoadMultiJobChange() {
MultiJobChange.loadMultiJobChange();
};
$(function () {
LoadMultiJobChange();
});
Code in Employee/Index.js file
function LoadEmployee() {
Employee.loadEmployee();
};
$(function () {
LoadEmployee();
});
Controller methods:
public class MultiJobChangeApiController : ApiController
{
// GET: api/MultiJobChangeApi
public List<userlist> Get()
{
dynamic model = null;
using (AppDevSecEntities ctx = new AppDevSecEntities())
{
var temp = ctx.UserLists.AsNoTracking().OrderByDescending(x => x.LastName);
if (temp != null)
model = temp.ToList<userlist>();
}
return model;
}
}
public class MultiJobChangeController : Controller
{
// GET: MultiJobChange
public ActionResult Index()
{
using (AppDevSecEntities ctx = new AppDevSecEntities())
{
BSCCrystalReportsViewerEntities ctx2 = new BSCCrystalReportsViewerEntities();
}
return View();
}
}
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
indian143 wrote:
window.open('...', '_self', false);
That line will replace the current page with the specified URL. Even if your AJAX request completed, the updates you make to your page when it completes would immediately be thrown away in order to load the new page.
You need to change your code to make the AJAX request and display the results when the new page is loaded. Or call the API from the server, and render the result in the view.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Can you please help me what could I place there, because when called that controller with a get, its going into the controller but the cshtml page that supposed to load is not loading after the Controller call and staying with the same old cshtml page after the call, I didn't get what to do, hence opted for this solution. Can you please help me what can I do to Navigate properly and calling the WebApi methods as well from js files.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Option 1:
You call the API, and then navigate to the new page when you've finished.
NB: Any changes you make to the current page when the AJAX call returns will be discarded.
loadEmployee: function (employeeID) {
return $.get("/BSCSecurityAddressBookWeb/api/EmployeeAPI/Get");
}
...
$("#btnEmployee").click(function (event) {
event.preventDefault();
Employee.loadEmployee().done(function(){
location.assign('/BSCSecurityAddressBookWeb/Employee/');
});
});
Option 2:
You navigate to the new page, and then call then API from that page.
$("#btnEmployee").click(function (event) {
event.preventDefault();
location.assign('/BSCSecurityAddressBookWeb/Employee/');
});
New page:
loadEmployee: function(employeeID){
$.get("/BSCSecurityAddressBookWeb/api/EmployeeAPI/Get").then(function(data){
...
});
}
...
$(function(){
Employee.loadEmployee();
});
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks my friend it was really successful
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
I would like to develop new project from scratch.
I would like to use ASP.NET MVC 5.0, EntityFramework and SQL Server.
Can anybody share some good approach for the same. I gone though some blogs but still I did not find perfect approach for the same. In lot of blogs I read that we need to use 3 layer/N layer architecture and use generic repository.
Can anybody please share their views what are the best practices for MVC / EntityFramework / SQL projects.
I am verymuch interested in creating new structure of project.
|
|
|
|
|
Google has lots of resources on these issues. And the answers to your question really depend on what you project is going to do.
|
|
|
|
|
Just suggestion try to start with only one or two views with small text on it and few Controllers. I have gone through your situation, right now little better but still learning. Once you get used to it, you will become perfect - go ahead buddy start putting small things, MVC looks difficult when you think, but once you start putting things together slowly it will become possible.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Hi,
I am getting the error when trying to load data from the WebApi call,
{"Message":"An error has occurred.","ExceptionMessage":"The 'ObjectContent`1' type failed to serialize the response body for content type 'application/json; charset=utf-8'.",
"ExceptionType":"System.InvalidOperationException","StackTrace":null,"InnerException":{"Message":"An error has occurred.","ExceptionMessage":
"The operation cannot be completed because the DbContext has been disposed.","ExceptionType":"System.InvalidOperationException","StackTrace":"
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()\r\n at System.Data.Entity.Internal.Linq.InternalQuery`1.GetEnumerator()\r\n at
System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.IEnumerable.GetEnumerator()\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList
(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)\r\n at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)\r\n at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)\r\n at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, Encoding effectiveEncoding)\r\n at System.Net.Http.Formatting.JsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, Encoding effectiveEncoding)\r\n at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, HttpContent content)\r\n at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.WebHost.HttpControllerHandler.<WriteBufferedResponseContentAsync>d__1b.MoveNext()"}}
My code looks like:
public List<UserList> Get()
{
dynamic model = null;
using (AppDevSecEntities ctx = new AppDevSecEntities())
{
var temp = ctx.UserLists.OrderByDescending(x => x.LastName);
if (temp != null)
model = temp.ToList<UserList>();
}
return model;
}
Any help would be very helpful thanks in advance.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
It looks like your entity has a navigation property, which isn't being eagerly loaded. When the framework tries to serialize the object to JSON, the main entity tries to load the related entity using lazy-loading. This fails because the DbContext has been disposed.
Entity Framework Loading Related Entities[^]
There are several options to solve this:
1) Turn off lazy loading:
The navigation properties in the returned JSON will all be null .
public List<UserList> Get()
{
using (AppDevSecEntities ctx = new AppDevSecEntities())
{
ctx.Configuration.LazyLoadingEnabled = false;
return ctx.UserLists.AsNoTracking().OrderByDescending(x => x.LastName).ToList();
}
}
2) Eagerly load the navigation properties:
You'll need to load all of the navigation properties you need to return. You'll still want to turn off lazy-loading.
public List<UserList> Get()
{
using (AppDevSecEntities ctx = new AppDevSecEntities())
{
ctx.Configuration.LazyLoadingEnabled = false;
return ctx.UserLists.AsNoTracking().Include(x => x.YourNavigationProperty).OrderByDescending(x => x.LastName).ToList();
}
}
3) Return a data transfer object (DTO)
Create a specific class containing just the data you need to return. You can either map the entities by hand, or use something like AutoMapper[^] to do the mapping for you.
public List<UserListDto> Get()
{
using (AppDevSecEntities ctx = new AppDevSecEntities())
{
ctx.Configuration.LazyLoadingEnabled = false;
return ctx.UserLists.AsNoTracking().OrderByDescending(x => x.LastName).ProjectTo<UserListDto>().ToList();
}
}
4) Store the context at the controller level:
A new instance of the controller class is created to serve each request, so it's safe to store the context at the controller level. You'll need to override Dispose to clean it up.
public class YourController : ApiController
{
public YourController()
{
Context = new AppDevSecEntities();
}
private AppDevSecEntities Context { get; }
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (disposing) Context.Dispose();
}
public List<UserList> Get()
{
return Context.UserLists.AsNoTracking().OrderByDescending(x => x.LastName).ToList();
}
}
NB: Since you're not updating the entities, it's a good idea to use the AsNoTracking method[^] to load them without tracking.
Entity Framework No-Tracking Queries[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Your WebAPI is attempting to serialize the object returned by your method, but the navigation properties point to the database connection built by the disposed connection.
There are many, many ways to skin this. The easiest (to me) is to locate the relationships in the Model that you do not want passed along with the basic call and decorate them with [JsonIgnore]. After doing that you can explicitly include them with the LINQ .Include(). You MUST have a reference to System.Data.Entity to use the strongly-typed extension of this method.
For example:
public class FooBar
{
...
[JsonIgnore]
public virtual ICollection<Foo> Foos { get; set; }
public virtual ICollection<Bar> Bars { get; set; }
}
Now your Get:
using System.Data.Entity;
...
public IEnumerable<FooBar> Get()
{
using(var context = new MyDbContext()){
{
return context.FooBars.Include(x => x.Bars).ToArray();
}
}
This will have the API respond to requests with all FooBars, with all associated Bars and no Foos. It's important to note that this will also need to be done with any other related models, so if Bar has relationship properties, you'll need to configure them for serialization.
By the way, using dynamic in a context where a strong type or generic will suffice is bad juju; it invites trouble.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Hello again experts,
We have a RadioButtonList inside a Repeater control with two options, Yes or No.
We would like to force our users to choose a Yes or No before proceeding.
In other words, if a user clicks to submit or in our case, click the Next button to go to the next without selecting either Yes or No, an error needs to be raised letting the user know that s/he must select a Yes or No to continue.
The following code uses RequiredValidator control to handle this but it does not do anything.
Any ideas how to resolve this?
Purchased:<asp:radiobuttonlist ID="rblType" runat="server" ValidationGroup ="stype" RepeatDirection="Horizontal" TextAlign="Right" style="display:inline;">
<asp:ListItem Text="Yes" />
<asp:ListItem Text="No" />
</asp:RadioButtonList>
<asp:RequiredFieldValidator id="RequiredFieldValidator1"
ControlToValidate="rblType"
ErrorMessage="required"
ValidationGroup ="stype"
runat="server"/>
Thanks a lot in advance.
|
|
|
|
|