|
Hi all,
I have developed a web application where there exists some data input pages. In those pages there exists a grid view below some text, drop down and other web controls. I need to display a msg if the user changes some thing in the page or worte in a textbox etc.. Any change made. I need to alert the user that changes has been made and give him the choice to save or not by display yes/no msg.
Any ideas how to do that?
thanks
|
|
|
|
|
You can do it by JavaScript itself.
var isDirty = false;
function SetControlChanged(){
isDirty = true;
}
function IsControlChanged(){
if (isDirty){
alert('You have changed some values');
}
return (!isDirty)
}
Call the SetControlChanged() function in all the control's onchange events.
Finally call the IsControlChanged() function to check the status.
|
|
|
|
|
Venkatesh Mookkan wrote: Finally call the IsControlChanged() function to check the status.
Where exactly is finally? Do i need to call this script on evry link, button, etc.. which redorect out side this page????
|
|
|
|
|
samerh wrote: Where exactly is finally?
The finally is exactly happens when you hit "Save". IsControlChanged() function is called
only on Save click.
Sorry Samerh, I haven't seen that "Page on leave" in the subject. You have to call the IsControlChanged() in page unload event.
|
|
|
|
|
Hii All,
I am creating a login screen in ASP.Net, and matching the input with the user id and password stored in the MySql Database. Here is the code which i am writing currently.
if (txtUserId.Text != "" &&
txtPass.Text != "")
{
try
{
con = new MySqlConnection(constring);
con.Open();
MySqlCommand cm = new MySqlCommand(
"Select UserId from Auth where , Pass='"
+ txtPass.Text + "'", con);
MySqlDataReader dr = cm.ExecuteReader();
if (!dr.Read())
MessageBox.Show("Access Denied, Make sure the User Id and Password you have entered is correct",
"Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
else if(dr.IsDBNull(0))
{
MessageBox.Show("Access Denied, there is no user, please enter with existing user id and password",
"Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
Response.Redirect("frmHomePage.aspx", false);
}
dr.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
con.Close();
}
else
{
MessageBox.Show("User Id and Password can not be left blank", "Error",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
This code is checking only for password but not for user id, even if iam entering wrong user id and correct password it is validating correct. What i need to do for checking both the input i.e. user id and password.
Any help will be appreciated
Thanks
Imran
|
|
|
|
|
ImranTech wrote:
MySqlCommand cm = new MySqlCommand(
"Select UserId from Auth where , Pass='"
+ txtPass.Text + "'", con);
Your SQL statement is wrong. You have to select the record which have the userid = userid rather than checking password. After the select the record validate your password.
MySqlCommand cm = new MySqlCommand(
"Select UserId, Pass from Auth where UserId='"
+ txtUser.Text + "'", con);
If record exists, check the password. Else throw the exception whatever you want to show.
|
|
|
|
|
Hi frnds,
i want a function to inform user's that when he is entering minus sign(-) at starting of the text alert message to be given
Thnks in advance
Pushpa
|
|
|
|
|
Try this,
if (MY_TEXT.indexOf('-') == 0){
alert(MY_MESSAGE);
}
|
|
|
|
|
thnks
|
|
|
|
|
I have to create subrows in a gridview
ex
1.First Heading
a
b
c
2.Second Heading
d
e
f
I want to show and hide the sub rows on click on heading on click on heading
Thanks in advance
Gaurav
|
|
|
|
|
How can i show the events inside a usercontrol in the properties window of the page where i am using the usercontrol?
[Browsable] is not working.Events are accessible from the design view but not showing in the events section of properties window.How can i do that?
arun
|
|
|
|
|
If you have created a Public Event it automatically show up in the Property Window under events section. There is no need to set the [Browsable] Attribute to the event.
Check where the reference is referring the right control.
|
|
|
|
|
My class is like this
public partial class ClassName: System.Web.UI.UserControl<br />
{<br />
[Browsable(true)]<br />
public event EventHandler ibtnApply_Click;<br />
......<br />
}
But its not coming in the page where am using this usercontrol.References are correct.hw can i do that?
arun
|
|
|
|
|
Sorry Arun. I am not sure about that. I have used UserControl with custom events. But I didn't found any problem unless, it is not refreshed properly in the Webpage's design mode. Drag & Drop it again and see.
|
|
|
|
|
The below code is meant to get data from a db, display the first row, sleep for 2 seconds then display the second row. Can anyone spot what i may have done wron???
many thanks.
Dim ds As DataSet = New DataSet
ad.Fill(ds, "tblcustomers")
Dim dtab As DataTable = ds.Tables(0)
Dim dtabclone As DataTable = dtab.Clone()
Dim drow As DataRow = dtab.Rows(0)
dtabclone.ImportRow(drow)
GridView1.DataSource = dtabclone
GridView1.DataBind()
'gridview1
System.Threading.Thread.Sleep(2000)
drow = dtab.Rows(1)
dtabclone.ImportRow(drow)
GridView1.DataSource = dtab.Clone
GridView1.DataBind()
|
|
|
|
|
solarthur01 wrote: The below code is meant to get data from a db, display the first row, sleep for 2 seconds then display the second row. Can anyone spot what i may have done wron???
Your are confused & you are not aware of what you are doing. The code (I am not sure how it works) executes in the Server-side, and the final result would be the output of
solarthur01 wrote: Dim ds As DataSet = New DataSet
ad.Fill(ds, "tblcustomers")
Dim dtab As DataTable = ds.Tables(0)
Dim dtabclone As DataTable = dtab.Clone()
Dim drow As DataRow = dtab.Rows(0)
dtabclone.ImportRow(drow)
GridView1.DataSource = dtabclone
GridView1.DataBind()
'gridview1
System.Threading.Thread.Sleep(2000)
drow = dtab.Rows(1)
dtabclone.ImportRow(drow)
GridView1.DataSource = dtab.Clone
GridView1.DataBind()
I think, you should try it with JavaScript + HTML Tables
|
|
|
|
|
the above code works (partially). it only displays one record. It is meant to display one record sleep for 2 seconds, then display the next record(as the code specifies).
|
|
|
|
|
I have built a online photo album that will feature pics of great looking american women
with a chat box that talks with everyone. What I want to build is a message box that you hit a send button and send a message to the corresponding pic.
Any suggestions or where to look?
|
|
|
|
|
in my cs file of the page i have added
Button1.Attributes.Add("onclick", "window.showModalDialog('Lookup.aspx?new=edit',null, 'status:no;dialogWidth:570px;dialogHeight:500px;di alogHide:true;help:no;scroll:no')");
this works quite gud................. lookup page opens as a dialog
But i have two buttons on Lookup page,,,, when i click any the lookup page is opened as a web page not as a dialog.......... i dont need to open it again ........ i have simply added some functionality to the onclick events....
why the dialog button opens web page instead of refreshing itself
Thanx
|
|
|
|
|
In the lookup page's design view give the below tag inside head tag.
<base target="_self" />
Then try again.
arun
|
|
|
|
|
i did so but i still have the same problem........this donot solve it
|
|
|
|
|
it works .........there was an error in my code due to which the statement was not working
|
|
|
|
|
now i am facing another problem
i open the dialog form Page1.aspx using
LinkButton2 .Attributes.Add("onclick", "window.showModalDialog('Lookup.aspx?new=new', null, 'status:no;dialogWidth:555px;dialogHeight:575px;di alogHide:true;help:no;scroll:no')");
Now i have an HTML control (input button) in its Clickevent i want to set the value of TextBox1 of the Page1 but when i write
window.opener.document.getElementById('TextBox1').value='ads';
i get the error
document.opener.document is null or not an object
i have also tried
window.opener.parent but it also gives error
How can i do this
|
|
|
|
|
Instead of opener use window.dialogArguments .
LinkButton2 .Attributes.Add("onclick", "window.showModalDialog('Lookup.aspx?new=new', null, 'status:no;dialogWidth:555px;dialogHeight:575px;di alogHide:true;help:no;scroll:no')");
Pass the value of textbox in place of null in the showModalDialog method(second argument).And then use window.dialogArguments from dialog.
Arun J
|
|
|
|
|
Is there any way to get the final dimensions of an ASPX page before it is rendered? I don't mean the size of the browser window (Request.Browser.ScreenPixelWidth...). I mean the complete size of the ASPX page, counting areas that can only be reached via scrollbar -- as in, to get a page to render without scrollbars in the browser I would have to expand my browser viewing areay to X-by-Y pixels...
Or maybe I should explain what my end game is: I want to create a div that overlays my entire ASPX page under certain conditions. When I make an absolute div positioned at 0,0 and sized to 100%, it only creates a div the size of the browser client area. So if my page is scrollable and the user scrolls, I get a nasty cutoff-line where the div ends.
Thanks.
modified on Wednesday, January 30, 2008 5:06:34 PM
|
|
|
|