|
Please tell me if you have any Idea or even a link, I just have some Idea of it. But I am not expert in AJAX or Javascript. Please tell me if you have any Idea other wise give me some link so that I can explore it myself. Thank you.
Regards,
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
Hi,
I am using
Datatable.Compute("MAX([Table]","")
to get the Minimum value in a column. It is getting correct values only if the column contains 2 didgit numbers. For example if amy column contains the values 100,180,85 like that,then it is not getting correct values.In this cas it getting 100 instead of 180.How to resolve this.
Please show me the right way..
Thanks RPM.
|
|
|
|
|
Rahul.P.Menon wrote: I am using
Datatable.Compute("MAX([Table]","")
to get the Minimum value in a column.
I am quite sure that you don't.
The syntax of the formula is not correct, and you can't use MAX to get a minimum...
Show the code that you are actually using, instead. It's impossible to find the error you are looking for in code that doesn't even contain the error, but contain other errors instead.
What is the data type of the field you are trying to get the minimum/maximum from? If you are comparing text, remember that "85" > "100".
---
Year happy = new Year(2007);
|
|
|
|
|
Hi Guffa,
Thanks for thr reply..This is the code I have used to find min..
Dim expr As String = "MIN([" & dtn.Columns(1).ColumnName.ToString & "])"<br />
Dim min, max As Double<br />
min = CType(dtn.Compute(expr, ""), Double)
And that datattable column,I have tried is of System.string and system.double.
But in both cases I am not getting the correct values if the column value contains more than 2 digits.
Pls help me..
Thanks RPM.
|
|
|
|
|
Guffa,
You are right 100%..The mistake was with the code only..
As you said when I used the column type of system.Double instead of system.String it is giving correct values...
Thanks very much for the great help and much appreciating.
Thanks again,
RPM.
SoftwareDeveloper(.NET)
|
|
|
|
|
How i can call java script from Content pages. Reference of js files is given on master pages.
Please help me and it would be gr8 help if you can share some sample code...
Amit
|
|
|
|
|
You can just use your script as if it was referenced from your content page. But you should be aware that you have to use the ClientID property on your controls because ASP.NET will change all the IDs on your controls when you use Masterpages. I can post some sample code on monday, when I get to the office.
Regards, Jon.
If the world should blow itself up, the last audible voice would be that of an expert saying it can't be done - Peter Ustinov
|
|
|
|
|
I have a tab control which is AJAX enabled, and each tab has a user control. Each user control has a GridView bound to a set of Textbox controls and validators associated with it. Validation is executed on one user control and this navigates to the second tab which binds the grid (under the other user control) to a new set of Textbox controls and validators. Once again, on the event handler of a click event, I perform validation.
Here's the problem: The Page.Validators collection object has all the validators from the 1st and 2nd user controls. I only want validators validating a grid from a single user control. I could set the .Visible property to false on a user control I don't want to validate, but that still leaves an issue with checking the Page.Validators collection object. I have to be able to navigate (set focus) on the textbox control associated with the invalid Validator. Somehow, I would like to clear out the validators from all but the one active user control. Any suggestions?(Remember, I have AJAX enabled)...thank you.
|
|
|
|
|
You can specify validation groups, then you can validate just the group you're interested in. I do this with an AJAX enabled page where there are several groups all visible, and I only want to validate one. Once you specify the validation groups in your ASPX, you can do this in your javascript:
Page_ClientValidate("ValidationGroupName");
if (Page_IsValid)
{
Proceed
}
The Page_ClientValidate call will handle showing your validators, but you need to do the check before you proceed with the AJAX call.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Thank you. However, I figured out an alternate solution to my problem. Since I'm only viewing one grid at a time, I didn't think to just bind a set of blank data to the other grid I tabbed away from. That way, the Page clears out the validators no longer there for the old grid. I just have to remember to rebind the data back when I go back to that tab. I tried what you suggested. But, when there is an invalid control, it become difficult when I want to "SetFocus" on that control because I have to look through all the Page.Validators and figure out which ones were for which grid. Thanks anyway.
|
|
|
|
|
Hi all.
I hope one of ya guys can cast a light over what is going on here.. When calling GetUser in MembershipProvider I lose the user object in what can best be illustrated with this code snippet:
MembershipUser user = MembershipProvider.GetUser(UserName, true);
Of course it's not as simple but let me elaborate.
I use Firebird as database and hence I use the Fb providers (FbMembershipProvider etc.) but due to design faults or my machine setup I've had to make my own implementations. My own custom providers are really simple.Here are some code snippets that should explain how they works:
// PrimeMembership.cs
// FbMembershipProvider doesn't read from web.config!?
public class PrimeMembership : FbMembershipProvider
{
public void ForceInitialize()
{
if (base.ApplicationName != "PrimeBooking")
{
NameValueCollection config = new NameValueCollection();
config.Add("connectionStringName", "Membership");
config.Add("enablePasswordRetrieval", "false");
...
base.Initialize("FirebirdMembershipProvider", config);
}
}
}
//PrimeBookingUser.cs
public interface IPrimeBookingUser
{
int ArtistID { get; }
UserType Role { get; }
}
/// <summary>
/// Same as <see cref="MembershipUser"/>MembershipUser but with
/// Artist ID and Role
/// </summary>
public sealed class PrimeBookingUser : MembershipUser, IPrimeBookingUser
{
...
/// <summary>
/// Constructor
/// </summary>
public PrimeBookingUser()
{
DataAccessLayerManager dal = DataAccessLayerManager.GetDALManager();
_artistID = (int)dal.OpenQueryScalar("GetArtistID", Parameter.GetParameter("MembershipGUID", this.ProviderUserKey,
System.Data.DbType.Guid, System.Data.ParameterDirection.Input));
}
}
Now that you have seen my custom implementation let's go to the code that causes the trouble. I have made a simple caching class called CacheManager (it's not really a manager but the name will hunt me until I make it a full blown manager) that uses the Cache class from ASP.NET.
1 /// <summary>
2 /// Gets the user.
3 /// </summary>
4 /// <returns>A user class that inherit from <see cref="MembershipUser">MembershipUser</see></returns>
5 public User GetUser() where User : MembershipUser
6 {
7 // First check to see if an instance of this user already exists in the Cache.
8 User cachedContact;
9
10 cachedContact = _context.Cache[_context.User.Identity.Name] as User;
11
12 if (null == cachedContact || cachedContact.ProviderUserKey == null)
13 {
14 if (_context.User.Identity.IsAuthenticated)
15 {
16 PrimeMembership provider = new PrimeMembership();
17 // force membership provider to initialize
18 provider.ForceInitialize();
19 // cachedContact is always null
20 cachedContact = provider.GetUser(_context.User.Identity.Name, true) as User;
21 }
22 else
23 {
24 FormsAuthentication.RedirectToLoginPage("msg=Du har været inaktiv i for lang "
25 + "tid. Log venligst på igen.");
26 }
27 }
28 return cachedContact;
29 }
Line 20 is the trouble maker. I have debugged the source code of FbMembershipProvider (the good thing of open-source) and it returns the user just fine. I don't know why I loose the reference but maybe it has to do with that the constructor of PrimeBookingUser is never called?
Anyway, I'll appreciate any help - I know this is a long post! Regards, Jon.
If the world should blow itself up, the last audible voice would be that of an expert saying it can't be done - Peter Ustinov
|
|
|
|
|
floppy_Bop wrote: 19 // cachedContact is always null
20 cachedContact = provider.GetUser(_context.User.Identity.Name, true) as User;
Looks like you are casting a parent object to a derived type. Which type do you create in the GetUser method of the provider?
|
|
|
|
|
Yes you're right. GetUser returns MembershipUser. Is it possible to do that? I don't know too much about the underlaying MSIL but in my logic the parent object structure should fit nicely in the derived one. If not - how can I cast MembershipUser to my custom MembershipUser?
Thanks in advance!
If the world should blow itself up, the last audible voice would be that of an expert saying it can't be done - Peter Ustinov
|
|
|
|
|
Basically, in C# you can cast a derived object to its base class, but not all instances of the base type can be cast to a derived child even the structure of the base type fits nicely in the derived one. Here, in the GetUser method of your custom membership provider if you create and return an object of the MembershipUser(the base type) then in the client code you cannot cast it to your custom membership user class (the derived one). However, if you create an object of your custom membership user in the GetUser method then the casting in the client code is fine though you use the base class MembershipUser(base) as the return type. It works because the real type of the returned object of the method is still your custom membership user.
+ So, in your custom provider you should override the GetUser method and return a real object of your custom membership user class.
+ Another option is that in the client code you instead of using casting, you can create an object of your custom membership user and copy all properties from the returned object(base type) to the new object. However, the first option is a better choice.
|
|
|
|
|
minhpc_bk wrote: + Another option is that in the client code you instead of using casting, you can create an object of your custom membership user and copy all properties from the returned object(base type) to the new object.
I guess you mean MemberwiseClone. I have to use that from inside my custom MembershipUser, so both methods will requirer me to override either FbMembershipProvider or MembershipUser which is something I was hoping not to do. It pains me enough that I had to make my stupid forceInitialize implementation. I've found this code snippet:
public static object ShallowClone(object obj)<br />
{<br />
return typeof(object).GetMethod("MemberwiseClone", System.Reflection.BindingFlags.NonPublic<br />
| System.Reflection.BindingFlags.Instance).Invoke(obj, new object[0]);<br />
} That I hope will do the job.. But thanks a lot - I would never have found out by my self.
Cheers, Jon.
If the world should blow itself up, the last audible voice would be that of an expert saying it can't be done - Peter Ustinov
|
|
|
|
|
My asp.net application has web.config file. I have some configuration sections that i want to place in another file say web2.config.
How can i use multiple configuratioin files in asp.net?
Someone told me to use the 'file' attribute. How to do that?
|
|
|
|
|
|
Thanks.
I found a lot of links on google and visted all of them. In one looked at the file attribute of appSettings that is used to refer appSettings stored in external file. I have my own custom settings in my custom sections. How to refer those?
|
|
|
|
|
Sir,
If I want to check the user not to fill numbers in character-required controls and characters in number-required controls.
Waiting for Reply
Durgesh
Durgesh Kumar Mishra
|
|
|
|
|
check it
Or if your really too lazy to find it yourself: (note these have limitations and I haven't checked for accuracy)
chars only: ^[a-zA-Z]*$
numbers only: ^[0-9]*$
|
|
|
|
|
alpha: ^\D+$
numbers: ^\d+$
|
|
|
|
|
Thanks Sir for ur co-operation. Thanks heartly.
Durgesh Kumar Mishra
|
|
|
|
|
Sir,
I've used required field validator and set all the properties and it works better at the time of post generated by 'Submit' button but if I click on my side-menu link buttonslike "Home" this field checks me and demands to fill these fields first. How I get rid of it. I want it should work with Submit button but let me go to other pages when I click on other Links.
Thanks and waiting
Durgesh
Durgesh Kumar Mishra
|
|
|
|
|
Check out the ValidationGroup property (both on validator and submit button)
|
|
|
|
|
Hi All...
I have a form that adds users to the application, I use a submit button to add with event onClick_Button, when I insert all data in fields and then press enter, it does not add until I click on to the submit button, I want to know how to fire the onClick_button event when I click enter button,,
Thanks alot...
Nour Abdel-Salam
|
|
|
|