|
Make sure you have a reference to the System.Data.DataSetExtensions assembly, and an Imports System.Data declaration at the top of your file.
The Field(Of T) method is an extension method defined in that namespace and assembly:
DataRowExtensions.Field<T> Method (DataRow, String)[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
When I add
Imports System.Data.DataSetExtensions
Module ModuleMain...
it saying it can't be found.
I do have reference added to the project.
|
|
|
|
|
The assembly is System.Data.DataSetExtensions ; the namespace is System.Data .
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
When I change my project properties to .net 3.5 I was able to add
Imports System.Data.DataSetExtensions
however even with that I still having issues with no key fields for selecting
is not a member of '<anonymous type="">'; it does not exist in the current context
For Each item In data
result.Rows.Add(item.EEGRP,item.ESSN, item.EENAML,item.EENAMF,item.EENAMM,item.EEADD1,item.EEADD2,...._
|
|
|
|
|
please can tell anyone about asp.net architecture in simple way
|
|
|
|
|
|
Hello,
I want to create the unit test for the windows 10 universal app but I don't want to use the Microsoft Unit test app.
Could anyone recommend me the third party tool to test the unit test cases fro the windows 10 universal app.
Thanks in advance.
|
|
|
|
|
Hello
The above is the error message I am getting followed by a long Stack Trace.
I have a small form here http://www.dimadayoub.net/contact.aspx[^] and, to test it, I leave the email field blank on purpose (when I do the same for the other two fields, Name and Message, I get an on screen warning to complete the fields - which is what should happen).
When I do the same with the email field, I get the above server error. The relevant code I have is this:
<p><asp:Label ID="Email" runat="server" Text="Email"></asp:Label>
<asp:TextBox ID="your_email" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ErrorMessage="*" ControlToValidate="your_email"
ValidationGroup="vgSubmit" ForeColor="#FF6666"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" Display="Dynamic" ErrorMessage="Please complete the Email field"
ValidationGroup="vgSubmit" ControlToValidate="your_email"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator></p>
What should I be correcting, please?
|
|
|
|
|
Remove the ValidationGroup="vgSubmit" attribute from both validators. Neither of your other validators have a validation group set, and neither does your submit button.
Specifying Validation Groups | MSDN[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Many thanks, Richard, for your reply.
I have done as you suggested and made a couple of other alterations.
The code now looks like this:
<p><asp:Label ID="Email" runat="server" Text="Email"></asp:Label>
<asp:TextBox ID="your_email" runat="server" ></asp:TextBox>
<asp:ValidationSummary ID="ValidationSummary1" runat="server" DisplayMode="SingleParagraph" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ErrorMessage="*" ControlToValidate="your_email" Display="None"
ForeColor="#FF6666"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" Display="None" ErrorMessage="Please complete the Email field"
ControlToValidate="your_email"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator></p>
The result is that when I complete the 3 fields correctly, the form is sent.
When I complete the Name and Message fields, and Email field (without the @), I get an on screen error: 'Please complete the Email field' (for some reason it is in a white font and not the red of ="#FF6666"). I will amend that so it reads 'Please enter a valid email address'.
When I leave the email field blank entirely (the form does not get sent, which is fine), but I can see a little asterisk. I presume that asterisk is this:
ErrorMessage="*"
Can I not replace that asterisk with the on screen message: 'Please complete the Email field'?
Thanks again.
|
|
|
|
|
The ErrorMessage is the message that gets displayed in the ValidationSummary . The Text is the message that gets displayed in-line. If you set the ErrorMessage without setting the Text , the same message is used in both places.
You've used Display="None" , so the validators aren't showing up in-line. Instead, the ValidationSummary is showing all of the error messages next to the email field. You haven't applied any styles to the ValidationSummary , which is why the messages are white.
I'd be inclined to put a single ValidationSummary at the top of your form. Then, for each validator, set the ErrorMessage to the message you want to display, the Text to * , and the Display to Dynamic .
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks again.
I think I am beginning to see what you mean - it will take some time for me to digest all your kind points. Yes, I can make those changes and see the results.
Do you mean apply CSS to ValidationSummary1, and not RegularExpressionValidator2, in order to add style to 'Please complete the Email field'?
|
|
|
|
|
You need to add style to both - the style on the ValidationSummary will apply to the summary messages at the top of the form, and the style on the individual validators will apply to the "*" that appears next to an invalid field.
I generally use a theme[^] folder with a .skin file to apply the same CssClass to all validators, and a CssClass to the ValidationSummary . That way, the settings are consistent across the site, and the style settings remain in the CSS file where they belong.
If you don't want to add a theme to your site, you'll need to set the CssClass on each validator and ValidationSummary wherever you use them.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Yes, there is a theme to the site: www.dimadayoub.net[^], so the style would need to be consistent.
Because space there is limited - the form is small - I was thinking of displaying the error messages in the form fields themselves.
My CSS is not that good to do that - not sure it can be done in HTML/CSS alone.
Grateful for your time.
|
|
|
|
|
hi Friends,
I want to create dynamic CSS for multiple ASP.NET controls , I have created required css but not able to create the css file where I want to store this css.
For eaxample:
I want to host multiple site with different css /template but same code. so I want to design separate css file based on site Id. so the need is that when a user set their css for all controls then we will save it in a separate css file.
Please tell me the way how can i do this.
|
|
|
|
|
Its very simple.
You can create a text file from your web page with your css code and save it as .css extension. (If unable yo create text file then please follow the link http://aspalliance.com/152_How_to_Create_a_text_file_in_ASP_NET_[^]
Basic process for set a css file
<head>
<link id="MyStyleSheet" rel="stylesheet" type="text/css" runat="server" />
</head>
But you need to set it from Code Behind
Then in your Page_Load , simply add a "href" attribute as below:
protected void Page_Init(object sender, EventArgs e)
{
var link = new HtmlLink();
link.Href = "~/styles/main.css";
link.Attributes.Add("rel", "stylesheet");
link.Attributes.Add("type", "text/css");
Page.Header.Controls.Add(link);
}
Hopefully its help you
|
|
|
|
|
What's the difference between 'model' and 'Model' in Asp.net MVC
|
|
|
|
|
Model represents the object (instance of the class) in your model .
For example, if your model is created as,
namespace Sample.Models {
public class Program {
public string Name { get; set; }
}
}
@model Program
<p>Model.Name</p>
This would write the value of Name in the paragraph.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
"model" is only used in the page directive at the top of the view to dictate which class the view uses for its model
@model MyClass
In the view itself Model represents the model that was passed to the view by the controller;
return View("MyView.cshtml", instanceOfMyClass)
So in the MyView.cshtml view code Model will represent instanceOfMyClass
|
|
|
|
|
Hi Everyone,
The company I work for has outsourced its website to a 3rd party, however we can write a custom error page to track 500 errors.
We would like to be able to create such a 500 error page to find out as much as much as we possibly can about what happened to cause the 500 error.
Also, we would like to get all the session and cookie data we can from the session that encountered the 500 error.
Then, we'd like to save all of that data into a DB table.
Have any of you done this sort of thing before, or have any recommendations?
All the Best to You!
Anne
|
|
|
|
|
Session timeout in ASP.NET?
Are you using Forms authentication?
Forms authentication uses it own value for timeout (30 min. by default). A forms authentication timeout will send the user to the login page with the session still active. This may look like the behavior your app gives when session times out making it easy to confuse one with the other.
<system.web>
<authentication mode="Forms">
<forms timeout="50"/>
</authentication>
<sessionState timeout="60" />
</system.web>
Setting the forms timeout to something less than the session timeout can give the user a window in which to log back in without losing any session data.
thanks
sign
Lowongan Kerja
modified 23-Oct-15 21:22pm.
|
|
|
|
|
Thanks, that is good to know.
A third party wrote the code, so I am not sure.
Anne
|
|
|
|
|
|
Thanks Daniel!
I'll take a look at those resources.
Anne
|
|
|
|
|
when i am accessing my application in lan ...then its working fine provided that firewall is off..which is not recommended..in this way when i turned on the firewall my application is not running...even after setting an inbound rules to the specific port m not able to access my application...how to fix this issue ..please help me out
Thanks
|
|
|
|