|
The error says you cannot use Items like a method. You used () instead of []. So, change Items(I) to Items[I]. You are not calling the method Items() you are accessing an item in the collection.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Seems like you are aware of VB.NET.
if (activitycode.Items(I).Value)
That is VB.NET way of accessing array elements, in C# that is used to invoke functions. What you need is like this,
if (activitycode.Items[I].Value)
This would work — provided no other errors are raised; is Value of bool type?. For more on this, you can just search for, "array indexing in c# vs vb.net", and also "how to call functions in c#" they will give you a good overview of these features.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
I am new to javascript but definitely not new to asp.net development. I was wondering why javascript is gaining popularity among asp.net developers
and what functionalities or features within an asp.net web application it is most often used for ;And also I was wondering is there a particular javascript book that would help me to learn the capabilities of javascript when used with asp.net. Thanks
|
|
|
|
|
There are lots of Javascript books, as there are lots of books on any subject, and Google will find them for you. You can learn Javascript basics quite quickly at JavaScript Tutorial[^].
|
|
|
|
|
You should definitely start with this: JavaScript: The Good Parts[^]
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
Patrick Rogers wrote: what functionalities or features within an asp.net web application it is most often used for For any time you do not want to have a full postback of your page. Which could be very often.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hi all,
I need any example or sample application or link anything to develop an ASP.Net MVC Single Page Application using Type Script. Can I write a Single Page application at all using ASP.Net and Type Script, if I can, can somebody please give me an example or sample code etc to help me out. I am new ASP.Net MVC and front-end coding I am more into Middle tier and Back-end coding.
Thanks in advance.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
|
Even a preciser answer than what Richard gave, ASP.NET Single Page Application | The ASP.NET Site[^].
TypeScript is just a superset of JavaScript, you can use that too, if you know how to use it. If these don't fit for your application, you may also learn the basic SPA template and apply it: Single-page application - Wikipedia[^], basically application just should not reload, it can change the content as required and requested.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Can you provide me an example so that I can maybe reverse Engineer it for my need, I am really poor in MVC, still struggling to connect between front end control with Controller Action, if the application has calls to action methods specially page submits that will help me a lot.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
That is why, SPAs use a client-side framework, such as Knockout etc instead of server-side. You need to learn how to use, example, Knockout.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
I want to pass the ACTIVITY_ID field (which is primary key) on an update statement where clause . I need help on how to do that. Here is Update Statement and parameters:
conn.ConnectionString = strConnection;
conn.Open();
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
cmd.CommandText = "UPDATE BUYING_ACTIVITY SET CUSTOMER_SOURCE_CODE = :custsrc, CUSTOMER_NAME =:name, CUSTOMER_CITY = :city, CUSTOMER_STATE = :state WHERE _ACTIVITY_ID = ?";
cmd.Parameters.Add(new OracleParameter(?));
cmd.Parameters.Add(new OracleParameter("custsrc", custsrc));
cmd.Parameters.Add(new OracleParameter("name", name));
cmd.Parameters.Add(new OracleParameter("city", city));
cmd.Parameters.Add(new OracleParameter("state", state));
cmd.ExecuteNonQuery();
conn.Close();
What value do I use to set = to ACTIVITY_ID on the WHERE clause is what I'm asking.
|
|
|
|
|
That is a Database question, nothing to do with ASP.NET.
|
|
|
|
|
You pass the value in the same way as the other parameters:
cmd.CommandText = "UPDATE BUYING_ACTIVITY SET CUSTOMER_SOURCE_CODE = :custsrc, CUSTOMER_NAME =:name, CUSTOMER_CITY = :city, CUSTOMER_STATE = :state WHERE _ACTIVITY_ID = :activity_id";
cmd.Parameters.Add(new OracleParameter("activity_id", activity_id));
cmd.Parameters.Add(new OracleParameter("custsrc", custsrc));
cmd.Parameters.Add(new OracleParameter("name", name));
cmd.Parameters.Add(new OracleParameter("city", city));
cmd.Parameters.Add(new OracleParameter("state", state));
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi All,
I have an MVC application which when I run the application it goes to http://localhost:49626/login.aspx?ReturnUrl=%2fhome%2findex, I am not sure why it goes and searches for the Login.aspx url, I am new to MVC, any help is going to be very helpful, I even set as specific page as this: home/index, still it goes onto login.aspx page.
I am very poor with url, I have register routes as below:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
Startup class as below
public class Startup
{
public void Configuration(IAppBuilder app)
{
}
}
I have area registration as below:
public class HelpPageAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "HelpPage";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"HelpPage_Default",
"Help/{action}/{apiId}",
new { controller = "Help", action = "Index", apiId = UrlParameter.Optional });
HelpPageConfig.Register(GlobalConfiguration.Configuration);
}
}
Any help is going to be very helpful for me as I am very poor in understanding the route mapping and configuration of ASP.Net MVC applications, any help a code snippet, a link or even suggestion would be very helpful, thanks in advance.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Sounds like you've got Forms Authentication configured, but pointing to a WebForms login page.
Have a look in web.config , under system.web/authentication , particularly the loginUrl attribute on the forms element.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
i want to ask about the post by ashish chaudhary, in which we are suppose to fill the datagrid and then export it to excel file. I am using the same code, but i am getting the error in the given below line.
"string Path = "D:\\DataListWebsite\\myexcelfile_" + DateTime.Now.ToString() + "_" + DateTime.Now.Month.ToString() + ".xls";
All the code is as it is..... No issue . Please help....
|
|
|
|
|
Should the quote in front of string be there?
|
|
|
|
|
Why not ask ashish chaudhary (whoever he/she is)?
|
|
|
|
|
First of all, like Richard said: Ask this question under their post because do not know the context that you are working under. So we cannot help you.
Finally, if the problem is with saving only you need to understand that you cannot have special symbols in filenames (": " for instance). DataTime object will hold these, for the time values, which causes the problem. That can be one of the problems here.
c# - How to remove illegal characters from path and filenames? - Stack Overflow[^]
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
how to populate textboxes on dropdown selection using .net mvc sqlserver 2013 without entitydata.
|
|
|
|
|
By writing a lot of code. Where are you stuck? I'm sure there are examples online you could follow. Ask Google, she knows everything.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I want to show required validator when Contract is selected on this toggle.
<label for="exampleNASAControlNumber">Is this a Contract or Solicitation?:</label>
<label class="switch2">
<input class="switch-input2" type="checkbox" id="contractselection" name="contractselection" runat="server"/>
</label>
The validation should work for this only when contract is selected:
<label for="exampleStartDate" style="position:relative; right:17px;">Contract Start Period:<span style="color:red">*</span>:</label>
<div class="bootstrap-iso">
<div class="row">
<div class=" zero-padding-left">
<div class="input-group">
<div class="input-group-addon">
</div>
<input class="form-control" id="contractstartdate" name="contractstartdate" runat="server" placeholder="MM/DD/YYYY" type="text" style="width:240px;"/>
</div>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" ForeColor="Red" runat="server" ControlToValidate ="contractstartdate" ErrorMessage="Please select a Contract Start Period">
</asp:RequiredFieldValidator>
and disabled for this validator:
<label for="exampleStartDate" style="position:relative; right:15px;">Solicitation Start Period:<span style="color:red">*</span>:</label>
<%----%>
<div class="bootstrap-iso">
<div class="input-group" style="position:relative; right:15px; width:296px;">
<div class="input-group-addon">
</div>
<input class="form-control" id="solicitationstartdate" name="solicitationstartdate" runat="server" placeholder="MM/DD/YYYY" type="text"/>
</div>
<asp:RequiredFieldValidator ID="RequiredFieldValidator8" ForeColor="Red" runat="server" ControlToValidate ="solicitationstartdate" ErrorMessage="Please select a Solicitation Start Period">
</asp:RequiredFieldValidator>
The reverse of this when Solicitation is selected, the Contract Start Date validator should be disable and the Solicitation Start Date validator is enabled.
How do I do this?
|
|
|
|
|
I did it using manual validation and jQuery.Validator.js. for MVC
I never used the validator for WebForms.
But I would remove your validators and go manual.
I wrote a jquery script called load_cc_validator and called it when I toggled the form module in jquery.
So I wrote the HTML in Razor and manually assigned the values
<h4>Card information</h4>
<div class="form-group">
@Html.Label("Edit_CC_FirstName", "First name on card", new { @class = "control-label" })
<div class="input-group">
@Html.TextBox("Edit_CC_FirstName", "", new { @class = "form-control", data_val = "true", data_val_required = "Card first name required", placeholder = "First name on card" })
@Html.ValidationMessage("Edit_CC_FirstName", new { @class = "field-validation-valid", data_valmsg_replace = "true" })
</div>
</div>
<div class="cxo-paymentForms-creditCard-submit right">
@Html.Hidden("Edit_CC_PaymentID")
@Html.Hidden("Edit_CC_Brand")
<button class="btn btn-default btn-lg mobile" type="button" onclick="return editPayment_cancel()">Cancel</button>
<button class="btn checkout pull-right mobile" type="button" onclick="return submit_eCC()">Save</button>
</div>
submit_eCC is just a $ajax call to the controller to update the database, and has nothing to do with validation.
editPayment_cancel just clears the form and hides the form module.
Since I'm using $ajax, I set the Submit Form Handler to false to not submit a post back of the form.
And then wrote the script and called it. This example reflects the whole module, and would take too much time to condense
function load_eCC_validate() {
var $cC_form = $("#Edit_CreditCard"),
$cC_location = $("#Edit_CC_LocationName"),
$cC_fName = $("#Edit_CC_FirstName"),
$cC_lName = $("#Edit_CC_LastName"),
$cC_code = $("#Edit_CC_Code"),
$cC_phone = $("#Edit_CC_Phone");
$bA_streetAddress1 = $("#Edit_CC_StreetAddress1"),
$bA_city = $("#Edit_CC_City"),
$bA_stateCode = $("#Edit_CC_StateCode"),
$bA_postalCode = $("#Edit_CC_PostalCode"),
$bA_countryCode = $("#Edit_CC_CountryCode");
$cC_form.validate({<br />
errorClass: 'form-control input-validation-error',
validClass: 'form-control',
errorElement: 'span',
success: "valid",
rules: {
"Edit_CC_LocationName": {
required: true
},
"Edit_CC_FirstName": {
required: true
},
"Edit_CC_LastName": {
required: true
},
"Edit_CC_ExpMonth": {
required: true,
valueNotEquals: ""
},
"Edit_CC_ExpYear": {
required: true,
valueNotEquals: ""
},
"#Edit_CC_Code": {
required: true
},
"Edit_CC_Phone": {
required: true,
phoneUS: true
},
"Edit_CC_StreetAddress1": {
required: true
},
"Edit_CC_City": {
required: true
},
"Edit_CC_StateCode": {
required: true
},
"Edit_CC_PostalCode": {
required: true,
zipcodeUS: true
},
"Edit_CC_CountryCode": {
required: true
}
},
messages: {
"Edit_CC_LocationName": "Unique name is required",
"Edit_CC_FirstName": "Card first name required",
"Edit_CC_LastName": "Card last name required",
"Edit_CC_Code": "Card Security code required",
"Edit_CC_ExpMonth": "Card exp month required",
"Edit_CC_ExpYear": "Card exp year required",
"Edit_CC_Phone": "Phone number required",
"Edit_CC_StreetAddress1": "Billing street address required",
"Edit_CC_City": "Billing city required",
"Edit_CC_StateCode": "Please select your state",
"Edit_CC_PostalCode": "Postal/zip code required",
"Edit_CC_CountryCode": "Please select your country"
},
submitHandler: function (form) {
return false;<br />
},
invalidHandler: function (event, validator) {
var errors = validator.numberOfInvalids();<br />
},
errorPlacement: function (error, element) {
$(element).parent().next('span').html(error);
}
});
}
This works exactly like assigning required to the model, only I didn't assign required to the model.
Hope this makes sense to you, can't really explain it in more detail. But the HTML I posted is exactly what is needed to make it work.
Note, you may be able to disable validation using jquery by changing one of the attr in the validator. You have to look at the HTML that is generated to see which attr to change in the elements.
21st Century Globalism has become Socialism on a planetary scale, in which the unequal treaties of the past have come back into play.
|
|
|
|
|
Perhaps Specifying Validation Groups may be what you need?
[^]
_______________________________________________________________
Ah don't lean on me man, cause you can't afford the ticket
|
|
|
|
|