How To Read The Numbers Entered By User For An Array
Mar 29, 2010In Console App what is the correct syntax to read n numbers from the User for a int Single dimension Array?
View 4 RepliesIn Console App what is the correct syntax to read n numbers from the User for a int Single dimension Array?
View 4 RepliesIf i use DataAnnotations on my Model and my model have something like this:
[Code]....
and in my View, i have a textbox WITHOUT client side validation. If the user enter non-numbers caracters in this field, i would like to validate on the server side that the user have entered non-authorized caracters and message him back on that. But since that my Model's Days property is a INT, the ModelBinder can't parse the string in the int property and generate an error in the ModelState with no message at all. And if the user doesnt enter anything on this field, the ModelBinder also try to put an empty string in a int property and generate an error in the ModelState with the message "a value is required". This is not the message that is written within the DataAnnotation. I have no control on the message that is generated.
So my question is:how can i valide the users input for int properties (or DateTime, etc...) and if the user enter a bad value i can put in the ValidationSummary something like this: "You can't only enter a numeric value for Days".
I want to compare a user-entered value on a Web form against an array of existing values from the database, and do so on blur. If match, then show error. Scenario is to stop user from needlessly filling out other fields if this record has already been entered.
how to trigger this? What parts are client-side, what parts are server-side? Can I do it without Javascript?
I know that I can declare an array using the following method, but assume there is an easier way.
var elem as new Array();
elem[0] = 1;
elem[1] = 2;
elem[2] = 3;
and so on......
Is there a short cut to simply adding the numbers 0 -20 to an array, and is there a shotcut to adding the 20 nuumbers minus a few such as 3, 9, and 17?
I m reading a text file line by line. I want to insert those records into database after reading all lines. So, i want to store the files that are read and want to insert after all the lines in the text file are read.
So how can I store the read file in the array.? How to declare that array.?
I want to be able to read data from a database through ASP.net code VB Code into an array and then pass it to an array in Javascript. How would I go about that?
View 8 Repliesi have a db with two simple tables:
tbl_events:
-Event_ID int
-Event_Name varchar
-Event_Organiser varchar tbl_events_organisers
-Organiser_ID int
-Organiser_name varchar
In event_organiser of tbl_events i want to store the organiser_ID's of the second table in an array, so a record in the first table will like something like:
-Event_ID=18
-Event_Name=My event name
-Event_Organiser= 15,31,109,21
I have the following code to generate table from User inputs for ROWs and COLUMNs and i Have created a new array. I need read the text value from table , convert it to int and save it in the array.
Table tbl = new
Table();// Add the table to the placeholder control
PlaceHolder1.Controls.Add(tbl);
// Now iterate through the table and add your controls
[Code].....
When I run this It throws an error that - Input string was not in correct format
in ASP.net website C# code
example:
in SQL server, I have table TaxTable with column named TaxID, SalaryFrom like this:
TaxID SalaryFrom
1 1
2 2083.00
3 2500.00
4 3333.00
5 5000.00
6 7917.00
is there a way to store the values under salaryfrom column into an array?
note: In C# , Im using system.data.common.DbProviderFactories
this is so that I can read data from both sql server and mysql
My web page contains a file upload control that is used to select excel file. What my code does; is to read the content of that file and store its content to DB. Right now, I save this file to server and read its content using OLEDB.I want to know is there any way i can read the content without saving it on the server?
View 2 RepliesI have setup a webservice that returns an array of Transaction objects (Transaction being a custom class I created). Each Transaction object has a range of properties (strings, dates etc) and a couple of other embedded objects. I have tested this from another asp.net application and I can consume the webservice fine and access all the objects etc.This webservice is returning Transaction objects that will be loaded into a database on the client side. The objects all come back in an array from the webservice, which needs to be handled via SSIS 2008 and loaded into a database on the client side. The question is, how do you configure the SSIS package to read and handle the incoming array and the custom objects within?
View 1 RepliesI have an ASP.Net UpdatePanel that updates on a timer. Within the UpdatePanel and nested in a GridView, I have a TextBox that the user enters a value in with a submit button. Everything works fine, except if the user does not submit the value before the timed interval, the text is removed from the TextBox. Is there a way to persist the user entry into the TextBox between updates? Is there a better way of doing this?
Code Postscript:
aspx:
<script type="text/javascript">
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_beginRequest(beginRequest);
function beginRequest() {
prm._scrollPosition = null;
}
</script>
<asp:Timer ID="Timer1" runat="server" Interval="900" OnTick="Timer1_Tick"></asp:Timer>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
<ContentTemplate>
<asp:DataList RepeatColumns="5" RepeatDirection="Horizontal" ID="dlMine" runat="server" OnItemCommand="Item_Command">
<ItemTemplate>
<div style="border:1px solid black;margin:3px;height:300px;text-align:center;padding:5px;">
<div style="width:150px;">
<asp:Label ID="lblTitle" runat="server" Text='<%# left(DataBinder.Eval(Container.DataItem,"title").ToString(), 75) %>'></asp:Label>
</div>
<asp:Label ID="Label1" runat="server" Text='<%# (DateTime)DataBinder.Eval(Container.DataItem,"end_date") %>'></asp:Label>
<br />
<asp:Label ID="Label2" runat="server" Text='<%# String.Format("{0:C}",DataBinder.Eval(Container.DataItem,"current_value")) %>'></asp:Label>
<br />
<asp:TextBox ID="txtNewValue" runat="server"></asp:TextBox>
<asp:Button Visible='<%# (isInThePast((DateTime)DataBinder.Eval(Container.DataItem,"end_date"))) ? false : true %>' CssClass="bid_button" runat="server" CommandArgument='<%# Eval("ID") %>' CommandName="Revalue" ID="btnBid" Text="Submit New Valuation" />
</div>
</ItemTemplate>
</asp:DataList>
[Code...]
I have a textbox defined as follows in my MVC app;
[Code]....
How do I get this textbox to do a postback once the user has entered data?
I have few textboxes on a page which are loaded dynamically on change of text in dropdownlist. The user enters values in these textboxes and clicks on a addnewitem button. In the code behind I want to capture the values entered in these textboxes. But I get the value as empty.
On Pageload mthd there is nothing which is referencing to createdynamiccontrols method.Then I have
[Code]....
Firstly i am getting object reference not set to an instance of an object when the createchildcontrols method is called the second time and also if I dont have the createdynamiccontrols method in additem click event, controls are no longer tehre...
The Problem:The user entered value is missing in the .Text attribute of the AjaxControlToolkit ComboBox when the enter key pressed. Also the "on change" events events are not called but I am not using postbacks anyway so I do not care.
Example: private void BuildFileListDetails(NHibernateDataProvider _providerM)
{
int resultsPage = Convert.ToInt32(ddlNavPageNumber.Text);[code].....
My Solution:I needed to access the AjaxToolkit "ComboBox" imbedded TextBox control's .Text to access the value entered by user.
private void BuildFileListDetails(NHibernateDataProvider _providerM)
{
int resultsPage = Convert.ToInt32(ddlNavPageNumber.Text);[code]......
We use the LoginControl to authenticate our users. For this particular site, security isn't a HUGE concern but the Membership provider allowed us to customize the users menu and do some other handy things.
Lately, our Customer Service department has been complaining that there is something wrong, because many users are being "locked out". What I would like to do is capture the login and password (I know how to get the login) and log it to our SQL database. Is there a way to get the un-encypted password? I am pretty sure there isn't but thought someone might know a workaound (without using a custom control of something of that nature).
I have a TextBox and I want that the user type just numbers, not other format.
How can I do that ?
I am getting this error:
CS1061: 'System.Data.SqlClient.SqlDataAdapter' does not contain a definition for 'Rows' and no extension method 'Rows' accepting a first argument of type 'System.Data.SqlClient.SqlDataAdapter' could be found.
Here is my code, what am I doing wrong?:
[Code]....
Here is what I'm trying to achieve: The user enters in the textbox a date. It can be:
20.04.2010 or 20/04/2010 or
01Apr2010 or Apr 01 2010...
Any other formats should be forbidden. When the user leaves the textbox then the date should be displayed as 01-Apr-2009. I already tried but I got only when am entering the numbers only like (21-04-2010) but I want to entering the string like apr, jan, nov .
basically I am try to replicate a filtered list like this;
[URL]
but I need it to work on an asp.net, and rather than having to hit a button to load an xml data file I need the data to be initialised when the page loads and get the data from a SQL Server database.
is there a standard .net control I can use?
I have a question for use Html.RenderPartial.
How do I assign records entered from a user control by Html.RenderPartial the model of objects of my main view?
Today when I try to save my record can not save the record of association with only the records of the Main View.
Basically the operation of the screen is the following, make the creation of a parent record and then join the other records. I want to save the parent record and associated records.
Currently, I'm just using clientside Javascript (location.href), but I am wondering if there is a way in Asp.Net to figure out the URL the user originally entered (assume I did not change it myself via 301), or at least to track it in a simple and reliable manner. As I am using my own implementation of URL rewriting via the global.asax (e.g. Context.RewritePath), this is not an easy task, particularly since I don't want to touch it too much.
Example
Global.asax:
public override void Init()
{
base.Init();
this.BeginRequest += new EventHandler(Global_BeginRequest);
}
void Global_BeginRequest(object sender, EventArgs e)
{
if (VARIOUSCONDITIONS) Context.RewritePath("SOMEURL");
}
SomePage.aspx.cs
protected void Page_Init(object sender, EventArgs e)
{
//Request.RawUrl is equal to "SOMEURL", as
//are other properties that store the URL.
}
In the new user registration page, how to check whether the email id entered by a user is valid? I want to check the entered email id actually exists before the user submits his information. do not give code for checking email id string using regular expression, I want to check whether the entered email id actually exists.
View 5 RepliesBeing in the learning phase of development in asp.net vb and sql server 2008...
the question m asking might seem to silly for many....
I have a login and a registration form for users... i hv done it
but my question is
1.how do v validate a user once he is registered
2.how can we show the details he had enterd while registration on his next login...
for example in facebook once registered the user can see his profile pic his profile info every time he logs in...
actually m nt able to create links between different tables storing various info. about users in database..
I am developing a page where i have a grid in content page (inherited from master page) which i am populating using DATASET in code behind like this here is the aspx.
[Code]....
As you can see i have some bound fields and one template field called "txtValue" which is the only input in gridview. Now what i want is when user input the value it should check the FACEVALUE and see if the entered value is not above the FACEVALUE and then need to Input value - FACEVALUE and result should be displayed in REMAINING field which is also a template field as label control.