|
You can use Convert.to... in C#
or
CAST('09/25/2004'AS DATETIME)... in SQL Server
|
|
|
|
|
how to check the username and password in login using hasrows in web applications
|
|
|
|
|
suriyakaqnnan wrote: using hasrows
Can you elaborate a little more on it?
suriyakaqnnan wrote: how to check the username and password in login<layer>
For checking username existence, you pass on the username to DB and run a query like:
SELECT COUNT(ID) from MyUserNameTable WHERE UserName = @userName
You check for number of rows returned for the query. If it 'has rows' then it means username already exists.
|
|
|
|
|
Select from database table if the username and password exists. Check for the no of results returned. If is 1 , user is authanticated if 0 , not.
|
|
|
|
|
Is there a cleaner way to pull a lot of data from a form for calculations?
I feel like I have a lotta ugly tryparse stuff going on. Do people just pull it in one go?
I have like 40 controls a user can change (trust me, it can't be helped) and on recalc its a lot of pull, calculate, put back. Seems horribly messy.
|
|
|
|
|
So I guess you don't want to put Javascript in your form to do the calculations ?
I have a fairly complex form with the same problem. I have 2 routines, one to map the screen to internal values and another to map the internal values to the screen. Ugly. Yes; but it works and it is straight forward.
|
|
|
|
|
Not especially no... for one Javascript still isn't as 'native' to me as a language. I imagine I'd have to learn some jquery to handle any of the database pulled information?
using javascript would at least get away from the parsing due to the weak typing though eh?
|
|
|
|
|
I have a huge product editor, with over 80 fields.
I'm on my 8th generation of it now.
The last update I made was to create a huge Javascript object of the entire thing, and small saves just update the object in the DOM, Full saves use $ajax to update the database.
Validation is on the fly using blur
When clicking through the tabs, the data is loaded from the object.
It took me a 2 week to write, over 10K lines of Javascript, but so far so good, no complaints after 3 months of running it.
It's a combination of Javascript and JQuery, but mostly Javascript.
|
|
|
|
|
Hi,
Can u Please take a look at my Question..
Help : Much Needed !![^]
Can u please suggest me a logic which can be used to involve BackGroundWorker Class in ASP.NET App?
A code snippet will be great..
Please it's very urgent.
|
|
|
|
|
sameerbhag wrote: Can u Please take a look at my Question.. Why? You have already received some suggestions there. If you don't understand, then post a reply to the people who responded, and ask for more information.
sameerbhag wrote: it's very urgent. Not to anyone here.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
You would have to write it in javascript, and run it on the client side if you want to see updates, you can try an update panel, but my experience is that it's 1 transmission to the server, and 1 transmission back, and then you have to do it again. I don't use them anymore.
So you would write your balance program in javascript, and create dynamic html via javascript to run in the report window.
Web programs do not run like windows programs, you have to change the way you think in designing your program mechanics. Shifting over to the client side would more closely mimic a windows program.
You can start by optimizing your program to run faster on the server side, get rid of the bloat first. Perhaps ask a small optimization question next.
A Simple Thread Snippet
http://stackoverflow.com/questions/1824933/right-way-to-create-thread-in-asp-net-web-application[^]
|
|
|
|
|
this is the code
static DataLoadOptions objDataLoadOption = GetDataLoadOpt();
public static DataLoadOptions GetDataLoadOpt()
{
DataLoadOptions dlo = new DataLoadOptions();
dlo.LoadWith<clsCustomerWithAddresses>(c => c.Addresses);
dlo.LoadWith<clsAddresses>(clsAddresses => clsAddresses.Phone);
return dlo;
}
this workd fine when i try to call it
objContext.LoadOptions = objDataLoadOption;
var MyQuery = from objCustomer in objContext.GetTable<clsCustomerWithAddresses>()
select objCustomer;
I want to change the loadwith option
for this i used reflection to check the forzen variable in dataloadoptions
var freeze = typeof(DataLoadOptions).GetField("frozen", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(objDataLoadOption);
if ((bool)freeze == true)
{
objDataLoadOption = new DataLoadOptions();
objDataLoadOption.LoadWith<clsPhone>(p => p.MobilePhone);
objContext.LoadOptions = objDataLoadOption;
all this works fine. Issue comes after some time. after 2-3 weeks i start getting
LoadWith is not allowed after freeze or attach to DataContext
any idea why i am getting this and how can it be stopped
|
|
|
|
|
You just cannot add load options to already existed context. Add desired options, and then use this context.
No more Mister Nice Guy... >: |
|
|
|
|
|
how can i get the checkbox text from database field name..
for example i have table..
no Fname Mname Lname
1 bilal khatri yousuf
2 faheem chania ali
how can iger the Fname in checkbox1. . . .
|
|
|
|
|
In HTML your output would be like this:
<INPUT TYPE='CHECKBOX' VALUE='1' ID='Name1'><LABEL FOR='Name1'>bilal khatri yousuf</LABEL><br/>
<INPUT TYPE='CHECKBOX' VALUE='2' ID='Name2'><LABEL FOR='Name2'>faheem chania ali</LABEL>
But I am not sure if this is what you want to know.
I wish I could believe there is an after life.
|
|
|
|
|
|
Get the text into a string , split it by space and get the first name.
|
|
|
|
|
Hi,
A really well written article, which I recommend you look at if you haven't at is Journey through the Javascript MVC Jungle[^].
Here's my dilemma. I want all the goodness of controllers, I want strongly typed views and model binding - basically all the best bits of MVC. However, even a fairly simple page will usually require some client side script for showing\hiding elements, confirmation boxes & all that funky stuff that users expect for todays interactive web pages. You normally end up with 'page specific script' which will be a number of event handlers and bindings, with no real structure as such.
Backbone, Knockout and many of the other frameworks mentioned in the article I linked address this problem, they allow you to create client side models and bring structure and cohesion to your client script. However, the way they are designed almost relegates MVC to a simple 'web API' to handle RESTful requests and respond with some JSON. You seem to end up moving logic that I believe should be in the 'server side controller' into a 'script controller', which I'm not really happy with.
I want a structured script representation of my Model, that wires up all by event handlers for my View and keeps everything in a logical order. But I still want model binding, data annotations, validation and logic in my controller, everything that should be handled by MVC.Net. I want the best of both in other words
I've read quite a bit on this subject, so I know there are many different options available to me - that's the very point of the link. I'm just interested how others developing in MVC are addressing this problem?
Most of the applications I'm working on at the moment are Line Of Business, but they can still have some fairly complex client side functionality. I'm not using any framework at the moment, I'm just namespacing my script and wrapping up some jQuery (i.e. Javascript modular pattern) ... it works, just not sure if it's the best way to be doing things.
Any thoughts?
Cheers
|
|
|
|
|
I'm using revealing module pattern and knockout
js file contains viewmodel something like this
var viewmodel = function (){
model = ko.mapping.fromJS([]),
init = function(initialData) {
model = initialData;
},
save = function(data, event) {
$.ajax({
});
},
delete = function(data, event) {
$.ajax({
});
};
return{
Init : init,
Save : save,
Delete : delete
};
};
view contains script to initialize viewModel and bindings
$(document).ready(function () {
viewmodel.Init(Model.toJSON());
ko.applyBindings(viewmodel);
});
Not sure if it's the best way but it works.
- Regards - J O N
|
|
|
|
|
|
that's exactly right. .NET Model is converted into JSON object and passed on to the Init function. In the Init when we do something like this we get the exact representation of the .NET Model in a javascript object with all items as knockout observables which is nice for a two-way binding.
model = ko.mapping.fromJS(initialData);
or
model = ko.wrap.fromJS(initialData);
- Regards - J O N
|
|
|
|
|
I have a textbox with multiline, i want to implement a feature in which i click a hyperlink or button then the whole content or selected content of textbox get copy to the clipboard.
Thanks In Advance,Appreciates your help
Vinay Sinha
|
|
|
|
|
Hi all, I am trying to create textboxes dynamically and I came across a method that does mostly what I want while searching for a solution on line. The method below is what I've found
for(int i = 0; i<boxes; i++)
{
TextBox tb = new TextBox();
tb.Location = new System.Drawing.Point(40, 120 + i * 20);
tb.Name = "TextBoxName" + i.ToString();
tb.Size = new System.Drawing.Size(184,20);
tb.TabIndex = i + 2;
tb.Text = String.Empty;
panel1.Controls.Add(tb);
}
The problem with the above code snippet is that sending values placed inside of the created textboxes to a database is difficult because the textboxes all have the same name. If each textbox can be given a different name when it is created, it will be great. Any suggestion is greatly appreciated, thanks in advance
|
|
|
|
|
Would you please explain how all textboxes have same name. The loop clearly says that every textbox created has index associated with its name. First textbox name reads "TextBoxName1", second reads "TextBoxName2" and so on. Where is the issue you are facing?
Thanks & Regards,
Vani Kulkarni
|
|
|
|
|
why dont u provide id of the texbox:
tb.ID="txtBox" + i;
u just pick id for your any operation.It will be unique.
I have replied as much i understand your problem.
|
|
|
|