|
Hi,
I have done this using update panel. It will not postback the page, but i want to reload a specific portion of the page then how can i do this?
I read a article some where that we can reload specific portion of the page using AJAX.
Thanks
Rahul
People Laugh on me Because i am Different but i Laugh on them
Because they all are same.
|
|
|
|
|
If your gridview is inside UpdatePanel then it should load only gridview and not all page.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
I have made login page...
And i'm taking the values from the 'tbLogin' table.
there are, for instance 5 entries in the table ...And i'm entering three entries out of 5...they are working fine but when I try to enter other two entries ....login form doesn't pick'em ..what could be the error ..plz help ..The coding for the login form is :
public partial class _Default : System.Web.UI.Page
{
SqlConnection con;
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
ViewState["LoginErrors"] = 0;
}
if (validateFunction(Login1.UserName,Login1.Password))
{
Response.Redirect("gallery.aspx?Name=" + Login1.UserName);
}
}
protected void Login1_Authenticate(object sender,AuthenticateEventArgs e)
{
if (validateFunction(Login1.UserName, Login1.Password))
{
Session["UserName"] = Login1.UserName.ToString();
Login1.Visible = false;
Response.Redirect("gallery.aspx?Name=" + Login1.UserName);
}
else
{
e.Authenticated = false;
}
}
private bool validateFunction(string username, string password)
{
bool returnval = false;
string strConnection = "Server=.\\sqlexpress;Integrated Security=true;Initial Catalog=dbLogin";
con = new SqlConnection(strConnection);
String sqlQuery = "SELECT UserName, password FROM tbLogin WHERE UserName='" + username + "' and password='"+password + "'";
cmd = new SqlCommand(sqlQuery, con);
Session["UserName"] = Login1.UserName.ToString();
SqlDataReader dtr;
con.Open();
dtr = cmd.ExecuteReader();
while (dtr.Read())
{
if ((username == dtr["UserName"].ToString()) & (password == dtr["password"].ToString()))
{
returnval = true;
}
dtr.Close();
return returnval;
}
return returnval;
}
protected void login_error(object sender, EventArgs e)
{
if (ViewState["LoginErrors"] == null)
ViewState["LoginErrors"] = 0;
int errorcount = (int)ViewState["LoginErrors"] + 1;
ViewState["LoginErrors"] = errorcount;
if ((errorcount > 3) && (Login1.PasswordRecoveryUrl != string.Empty))
{
Response.Redirect(Login1.PasswordRecoveryUrl);
}
}
the table "tbLogin" columns are:
UserName,
Password
UserId
plz help in finding the error
|
|
|
|
|
Which error message do you get?
By the way, use stored procedures with parameteres to prevent SQL Injection.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
error is that I could not retrieve all the records from the table..Instead, some of them are used perfectly.but some are not.
For instance, there are 3 records in the table "tbLogin".
Now 2 records are taken well in the login page .but last entry has not been taken by it ..
|
|
|
|
|
Since you are using the username and password directly in the select query your query might fail if there is any mismatch between the input and the database value. Depending on the server's case sensitivity settings, 'ABC' might not be equal to 'abc'. Also check if your passwords match exactly, no spaces on the ends.
Also, your design is perfect for SQL injection. You need to atleast sanitize your data before using it in your query! A better suggestion would be to use stored procedures.
If you cannot do either of this just get the userid and password based on just the user id. Then check the user password against the database password in code, just like its done now. Even here you need to sanitize the username before you use it in your query.
|
|
|
|
|
username and passwords are both in small letters and I'm entering the same values in the login form ...but some of them are being run successfully and some are not run..
wat could be the other solution.
my coding is also sanitised as its not on a large scale rite now ..its a small project..And I'm just pracising for building the login web page in asp.net using C#
|
|
|
|
|
We cannot identify the error with this information. As far as I can see this is a data issue and not a code issue. Try this -
Put a breakpoint on your code after the query generation line and get the query that is to be executed. Examine the query and the data. If it is just test data, then post your query and the data here.
|
|
|
|
|
I have done that .And the error is in the SQldatareader .
SQlDataReader's Object doesn't take the right username and password. wat to do to remove this error?
|
|
|
|
|
As in the username and password in the query is different from the ones you entered on screen?
Can you post some sample data?
|
|
|
|
|
ya sure...
for instance, in the "tbLogin" table .there are records as the following:
UserId UserName Password
12 rahul rahul
143 amit amit
32 rajni rajni
543 anuj anuj
Among the above records, usernames "amit" , "rahul" and "anuj" are working fine but the username "rajni" and its corresponding password is not being taken by the login form.
I hope u understand the problem now
|
|
|
|
|
What is the query text when you try rajni in the login form?
|
|
|
|
|
its the following :
string str = "Select userName, Password FROM tbLogin
Where userName= '" + txtUserName.Text + "' and Password = '" + txtPass.Text + "' ";
|
|
|
|
|
Buddy, I want the query text and not the code!
|
|
|
|
|
what do u mean by query text ...i don't understand
|
|
|
|
|
Once the line of code where you form the query is executed, the string variable str would contain the query in plain text. You need to check that to find out what query is executed against the database table!
Now in your IDE, put a breakpoint on this line of code, execute your application and step through to get the value in str variable. Once you do that post it here.
|
|
|
|
|
|
Hi
I have take a calender and a formview.
we want that when we click on calendar any particular date,so that date
come in textbox of formview. It's mean ,i am taking TextBox in Formview.
How we will fectch that calendar date in formview textbox.
plz help me soon?????
Thanks
Vivek
|
|
|
|
|
hi
I want simple html editor in asp.net.if any body have code in asp.net plz help me.
thnaks
|
|
|
|
|
|
how to download code for htmleditor from that site?i saw the editor but unable to download the code.
|
|
|
|
|
|
i m using asp.net 2.0,there is no editor option when i instal asp.net controltoolkit for 2.0
|
|
|
|
|
Hi ,
You can use FCK editor ot FreeTextBox.
Thanks
Rahul
People Laugh on me Because i am Different but i Laugh on them
Because they all are same.
|
|
|
|
|
Hi,
there are many open source HTML editors, you can try this:
http://tinymce.moxiecode.com/index.php
modified 27-May-14 5:10am.
|
|
|
|