|
Hello all,
I am new to .net, m developing a small application, the problem i face is whenever there is a postback on my page the font size of the whole page increases. How can i avoid this ??
Any help would be appreciable.
Thanks in advance.
Deepak
|
|
|
|
|
Hi
If font size increases after postback, it means there is some javascript error.
If it so, but how to check?? Then double click on the left corner of your web browser. (Instead of text 'Done', text 'Done with some errors' will be displayed if there is an error in your .aspx). Error may be syntax error or Braces not enclosed etc...
Check it now. Hope you got it.
- Harini
|
|
|
|
|
Hello All,
I have a web page with login control binded to custom sql membershipProvider to authorise the user. I was trying to use GetUser() method to display username but it is giving an error, I think i need to override
Membership.GetUser() method as well becos i understand its not using my custom SQL membership provider to get the loginname but iam stuck dont know how to acheive that. can someone help me out here, please see code below.
Login.aspx.cs
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
bool Authenticated = false;
Authenticated = SiteLevelCustomAuthenticationMethod(Login1.UserName, Login1.Password);
e.Authenticated = Authenticated;
if (Authenticated == true)
{
Response.Redirect(
"Welcome.aspx");
}
}
private bool SiteLevelCustomAuthenticationMethod(string UserName, string Password)
{
System.Data.SqlClient.
SqlConnection Con = new System.Data.SqlClient.SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);
System.Data.SqlClient.
SqlCommand Cmd = new System.Data.SqlClient.SqlCommand();
Cmd.Connection = Con;
Cmd.CommandType =
CommandType.StoredProcedure;
try
{
Con.Open();
Cmd.CommandText =
"name";
Cmd.Parameters.Add(
"@UserName", SqlDbType.VarChar, 20);
Cmd.Parameters[
"@UserName"].Value = UserName;
Cmd.Parameters.Add(
"@Password", SqlDbType.VarChar, 20);
Cmd.Parameters[
"@Password"].Value = Password;
System.Data.SqlClient.
SqlDataReader reader = Cmd.ExecuteReader(CommandBehavior.CloseConnection);
if (reader.HasRows)
{
return true;
}
else
{
return false;
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
//Return False;
}
throw new Exception("The method or operation is not implemented.");
}
Welcome.aspx.cs (After user logs in he is redirected to this page)
protected
void Page_Load(object sender, EventArgs e)
{
MembershipUser CurrentUser = Membership.GetUser(true); [This gives me an error ]
Label1.Text = CurrentUser.UserName.ToString();
}
Thanks in Advance for your help. Best Regards
|
|
|
|
|
Hi
How to get all the tables with their schema name in sql server 2005.
I am using adventures database. I know how to display all the tables in the database.
select * from information_schema.tables where table_type='base table'
I want to append the owner name (dbo.sales, sales.product )
can any one help me to solve my problem please?
kesavan
kesavan
|
|
|
|
|
select Table_Schema+'.'+Table_Name as fullname from information_schema.tables where table_type='base table'
|
|
|
|
|
I got a static page where I got 2 textbox for user logon so they can log on remotely from home and can access their work folders (home directory) and save document. what are the steps needed please help.
thanks
|
|
|
|
|
hi,
May i know what this error refers to..
Error 1 Only assignment, call, increment, decrement, and new object expressions can be used as a statement C:\Documents and Settings\user\Desktop\Naveed\WindowsApplication8\WindowsApplication8\Form1.cs 24 13 WindowsApplication8
Thank u
|
|
|
|
|
What is on the line the error refers to?
|
|
|
|
|
Hi All,
Kindly let me know the method, How to Maximize loaded program.
Example:
--------
Only Notepad is running on my system which is already minimized on the tray, and I want to maximize it using C# code.
Thank you
|
|
|
|
|
You need to p/invoke some windows api to achieve this. First you need to get the handle of the window that should be maximized and then use that hahndle to maximize it. Take a look at this these on pinvoke.net:
FindWindow (user32)[^]
ShowWindow (user32)[^]
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Dear Mr. Stefan Troschtz
Thank you of your kind respons
|
|
|
|
|
My pleasure
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi,
I'm trying to use the Conditional Operator in C# in the form of
<bool condition> ? <true value> : <false value>;
and I want the value to return as NULL if the condition is false.
For example:
bool _validated = _boolText != null? bool.Parse(_boolText): null;
But an error occurs when trying to build.
Here is the error message:
Type of conditional expression cannot be determined because there is no implicit conversion between 'bool' and '<null>'
How can I solve this problem?
Thank you very much.
KiT
-- Never wait for a chance to come, Believe in your own potential and go get it! --
|
|
|
|
|
You must declare your boolean type variable to a nullable boolean, but this will only works in .NET 2005.
bool? _validated = _boolText != null ? bool.Parse(_boolText): null;
If you want to declare a nullable bool just add suffix "?" symbol to your datatype.
ex.
bool?
int?
string?
regards,
mark
-- modified at 1:51 Friday 23rd February, 2007
|
|
|
|
|
Hey that is cool.
Thanks Mark.
- Harini
|
|
|
|
|
|
Wow! Thanx a lot, Mark.
Never known there is this trick in C# 2.0.
By the way, is there any way to convert from non-nullable to nullable?
Say... I need to assign a value to a variable for web service.
In my provided example, the variable for a web service is of bool type.
How can i convert it to "bool?" ?
Thank you very much.
KiT
-- Never wait for a chance to come, Believe in your own potential and go get it! --
|
|
|
|
|
The non-nullable bool have two posible values either True or false only. I think It's imposible that your web services will return a null value if does this will generate an error object not set to instance. Back to your question. Yes, you can, just cast it.
bool? myvar = (bool?)MyWebServiceMethodBool();
Note: MyWebServiceMethodBool() will only return True or false because the data type of this method is non-nullable boolean the only posible value this method will return is either true or false.
the new myvar variable can have three value (true,false and null)
regards,
Mark
|
|
|
|
|
I see.
Thank you very much.
You're the man.
KiT
Never wait for a chance to come, Believe in your own potential and go get it!
|
|
|
|
|
Wow! I have given score 5 out of 5 for this.
Harini
|
|
|
|
|
hi all,
I am using a webbrowser control in my application.I have a menu which can open or save files displayed in the browser.I am able to open all office documents and text files in the browser.
Also i am able to edit the office documents and make changes and also able to save them.But when i open a text file in the browser, i am not able to edit the text in the browser.
Can anybody suggest me how to do this?
Thanks in advance.
Regards
Anuradha
|
|
|
|
|
Hi,
I think that you can't edit a simple txt file in the browser because the browser only shows its content. When you open office documents, the browser opens the files inside the browser with the properly app, but in the case of the txt file only reads its content and shows it.
An alternative solution is that you add a button that open a dialog form that let the user edit the text in a richtextbox...
|
|
|
|
|
hi,
Thanks for the response.I think you are right. The normal browser opens all the text files as well as the office documents in a separate file and makes them editable.
Maybe i should try for that.
Thanks for your help anyway..
Thanks in advance.
Regards
Anuradha
|
|
|
|
|
hi,
Thanks for the response.I think you are right. The normal browser opens all the text files as well as the office documents in a separate file and makes them editable.
Maybe i should try for that.
Thanks for your help anyway..
Thanks in advance.
Regards
Anuradha
|
|
|
|
|
I am looking for a C# WPF carousel project, but so far I was not able to find any that works.
The effect must be similar to those that can be done with flash or to this screen shot:
http://www.zapsolution.com/preview/carousel.jpg[^]
Thank you
Patrice Terrier
|
|
|
|