|
Hi Devs,
I have couple of button in a form and sometimes when i click on it, instead of jumping to button1_click it jumps to one of the dropdownlist1_SelectedIndexChanged and generates error and application fails. And this doesn't happen every time but it is happening randomly.
Any idea what's going wrong here ??
Thank You
Andyyy
|
|
|
|
|
Are you sure the action occuring behind the button click event isn't, under specific circumstances, changing the selected index in the drop down list, (i.e., maybe it's filtering or repopulating the items in the the drop down list), and thus firing the index changed event entirely appropriately as the selected index has actually changed?
Rhys
"The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it"
They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance."
Terry Pratchett
|
|
|
|
|
Good point. I will have a look if that's the case.
Thanks
|
|
|
|
|
Hi,
Just check the event binding of the specified control.
Regards
Saanj
Either you love IT or leave IT...
|
|
|
|
|
considering hosting website on vmware? advantage is i can snapshots and if suspect security breach i can always revert back to a prev snapshot (or i can even do this say weekly)?
downside is of course it's slow[er]
anyone with experience in this?
dev
|
|
|
|
|
Its fine for testing purpose, but i will recommended not to use in production environment. Because for speed of server. I don't know the configuration of your server. If backup is the only reason to use VMware, you can use other tools to backup. . This is my personal opinion.
|
|
|
|
|
but being able to restore snapshot say weekly (or even daily) really gives peace of mind any security breach won't linger too long...
dev
|
|
|
|
|
devvvy wrote: downside is of course it's slow[er]
Well, it depends on how you configure the VM.
In a ideal case, the pefromance should ot differ from a physical server.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
there's got to be difference, just how much and how much is acceptable...
you done this in a prod env before? I am contemplating doing this for a low-medium traffic shopping site.
dev
|
|
|
|
|
This is an insane idea. You can install all sorts of backup software on your server that does what VMWare does with snapshots.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
no not just disk backup - what if your box has been hacked and you don't know what it is? If I can say even restore snapshot on say monthly basis - I can have the peace of mind my system is *clean*.
I'm considering this for a site with low-medium traffic - if speed is concern then I can buy faster hardware to compensate.
dev
|
|
|
|
|
devvvy wrote: no not just disk backup - what if your box has been hacked and you don't know what it is? If I can say even restore snapshot on say monthly basis - I can have the peace of mind my system is *clean*.
You can backup your entire system with tools like Ghost, on a regular basis, and you can restore the hard drive to that state, just like a snapshot.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Hi all,
I developed workflow application in .NET with framework 3.5,
I Put 2 interactivity in workflow as A1 and A2,
A1 is connected to A2, And A2 is last activity,
But when I run application first time it gives me following error,
"Value cannot be null. Parameter name: workflowType"
Please help me urgent,
Thanks in Advanced,
Bhushan
|
|
|
|
|
Bhushan M Jsohi wrote: But when I run application first time it gives me following error,
"Value cannot be null. Parameter name: workflowType"
Its very difficult to say the reason with out your code. You are passing any parameter named workflowType which is passed as a null. So verify your code.
BTW : This is not related with ASP.NET, you need to post it over here WPF/WCF/WWF Forums
|
|
|
|
|
we completed the registration page in our project and whatever the details we have given in that registration page they are also going to update in the backend also. but whatever the username and password we have given in the registration page is not accepted by the login page.while giving the username and password it is showing the error like below
object reference is not set to an instance of an object
code i have written for registration page
bal data = new bal();
data.FirstName = Text_FirstName.Text.Trim();
data.LastName = Text_LastName.Text.Trim();
data.Gender = Text_Gender.Text.Trim();
data.EmailId = Text_EmailId.Text.Trim();
data.UserName = Text_UserName.Text.Trim();
data.Password = Text_Password.Text.Trim();
data.ConfirmPassword = Text_ConfirmPassword.Text.Trim();
data.Country = ddlCountry.SelectedItem.ToString();
data.State = Text_state.Text.Trim();
data.City = Text_City.Text.Trim();
data.Dob = DateTime.Parse(Dob.Value);
data.PhoneNumber = Text_PhoneNumber.Text.Trim();
data.MobileNumber = Text_MobileNumber.Text.Trim();
data.Currentlocation = Text_Currentlocation.Text.Trim();
data.PreferedJobLocations = Text_Location.Text.Trim();
data.JobCategory = ddljobcategory.SelectedItem.ToString();
data.KeySkills = Text_KeySkills.Text.Trim();
data.HighestQualificationheld = ddlhqh.SelectedItem.ToString();
data.SpecialisationMajor = ddlspecialisation.SelectedItem.ToString();
data.Institute = ddlinstitute.SelectedItem.ToString();
data.YearPassedOut = ddlyrpassedout.SelectedItem.ToString();
try
{
int res = data.insertreg();
if (res > 0)
{
Page.RegisterStartupScript("SS", "<script> alert('Completed Successfully');</script>");
}
else
{
lblmessage.Text = "registration failed";
}
}
catch
{
}
i have used 3 tier architecture
the code in the dal layer for registration page
static SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ToString());
internal static int insertreg(bal bal)
{
//throw new NotImplementedException();
con.Close();
con.Open();
SqlCommand cmd = new SqlCommand("sp_reg", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@FirstName", bal.FirstName);
cmd.Parameters.AddWithValue("@LastName", bal.LastName);
cmd.Parameters.AddWithValue("@Gender", bal.Gender);
cmd.Parameters.AddWithValue("@EmailId", bal.EmailId);
cmd.Parameters.AddWithValue("@UserName", bal.UserName);
cmd.Parameters.AddWithValue("@Password", bal.Password);
cmd.Parameters.AddWithValue("@ConfirmPassword", bal.ConfirmPassword);
cmd.Parameters.AddWithValue("@Country", bal.Country);
cmd.Parameters.AddWithValue("@State", bal.State);
cmd.Parameters.AddWithValue("@City", bal.City);
cmd.Parameters.AddWithValue("@Dob", bal.Dob);
cmd.Parameters.AddWithValue("@PhoneNumber", bal.PhoneNumber);
cmd.Parameters.AddWithValue("@MobileNumber", bal.MobileNumber);
cmd.Parameters.AddWithValue("@Currentlocation", bal.Currentlocation);
cmd.Parameters.AddWithValue("@PreferedJobLocations", bal.Currentlocation);
cmd.Parameters.AddWithValue("@JobCategory", bal.JobCategory);
cmd.Parameters.AddWithValue("@KeySkills", bal.KeySkills);
cmd.Parameters.AddWithValue("@HighestQualificationheld", bal.HighestQualificationheld);
cmd.Parameters.AddWithValue("@SpecialisationMajor", bal.SpecialisationMajor);
cmd.Parameters.AddWithValue("@Institute", bal.Institute);
cmd.Parameters.AddWithValue("@YearPassedOut", bal.YearPassedOut);
cmd.Parameters.AddWithValue("@type", "i");
try
{
return cmd.ExecuteNonQuery();
}
catch
{
throw;
}
finally
{
con.Close();
cmd.Dispose();
}
}
}
code i have written for login page
protected void Button1_Click(object sender, EventArgs e)
{
loginbal data = new loginbal();
data.userid = txt_userid.Text.Trim();
data.password = txt_password.Text.Trim();
DataSet ds = new DataSet();
ds = data.getuserID();
}
}
the code in the dal layer for registration page
static SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ToString());
internal static DataSet GetUserID(loginbal loginbal)
{
//throw new NotImplementedException();
con.Close();
con.Open();
SqlCommand cmd = new SqlCommand("sp_login", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@userid",loginbal.userid);
cmd.Parameters.AddWithValue("@password",loginbal.password);
cmd.Parameters.AddWithValue("@type","s");
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
try
{
return ds;
}
catch
{
throw;
}
finally
{
cmd.Dispose();
con.Close();
}
}
}
|
|
|
|
|
sritha wrote: object reference is not set to an instance of an object
And what line is that error occurring?
sritha wrote: catch
{
}
This is bad practice - Don't do it.
sritha wrote: try
{
return ds;
}
catch
{
throw;
}
finally
{
cmd.Dispose();
con.Close();
}
WTF?
Exactly what exception will return ds throw? Surely the try block should go around everything, not just the last line.
You are not doing anything in the catch block other than rethrowing the exception. Remove the catch block it is not required.
Your connection is stored elsewhere. .NET does connection pooling, don't keep connection objects around, create a new one each time.
Man who stand on hill with mouth open wait long time for roast duck to drop in
|
|
|
|
|
Hi,
Have you tried to debug it by setting breakpoints and stepping into the execution lines? Debug and you will definitely find the issue.
Regards
Saanj
Either you love IT or leave IT...
|
|
|
|
|
sritha wrote: object reference is not set to an instance of an object
Did you debug your code? Where are you getting the error ? Does that object initialize?
|
|
|
|
|
Hi There,
I am working on ERP products using Asp.Net 2.0 and I am going to switch on 3.5 I know
basic queries of linq.But I want to know weather it is possible to write complex queries which inclueds caculation or large amount of data manupulation using linq.
Thanks.
|
|
|
|
|
There is a seperate forum on LINQ[^]
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hi All,
I need to create pdf file using iTextSharp. I can write simple text in my pdf file. But How can I add html content in pdf file.
I used string variable to hold html content. But when I use that variable my pdf file content not showing html format.
my Code given below :
private void createPDF()
{
//string newFile = @"N:\.NET\New Document.pdf";
string strContent = "";
StringWriter sw = new StringWriter();
string newFile = Server.MapPath("1.pdf");
Document doc = new Document();
PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(newFile, FileMode.Create));
// Metadata
doc.AddCreator("PDF Printer by Joachim Tesznar");
doc.AddTitle("New PDF Document");
// Add content
doc.Open();
sw.Write(GetMailBodyOrderDetails().ToString());
doc.Add(new Paragraph(sw.ToString()));
doc.Close();
}
#region string GetMailBodyOrderDetails()
public string GetMailBodyOrderDetails()
{
StreamReader StmRdr1 = null;
FileInfo fi1 = null;
string strFileName1 = Request.PhysicalApplicationPath + "Registration.html";
fi1 = new FileInfo(strFileName1);
if (fi1.Exists)
{
StmRdr1 = File.OpenText(strFileName1);
StreamReaderStrLine1 = StmRdr1.ReadToEnd();
// StreamReaderStrLine1 = StreamReaderStrLine1.Replace("<TITLE>", ListingName).Replace("<PRICE>", Price.ToString()).Replace("<DESCRIPTION>", ListingDetail).Replace("<EMAIL>", Email).Replace("<COUNTRY>", Country).Replace("<STATE>", State).Replace("<SUBURB>", City).Replace("<TOPADS>", "No");
StreamReaderStrLine1 = StreamReaderStrLine1.Replace("\r\n", "");
StreamReaderStrLine1 = StreamReaderStrLine1.Replace("<!--body", ".body").Replace("}-->", "}").Replace("\t", "");
}
return StreamReaderStrLine1;
}
#endregion
please reply
Thanks
Raj
|
|
|
|
|
Hi to all,
How to read UNREAD mails from mail server through .netcode???
|
|
|
|
|
Is your application going to read emails from Exchange Server?
Regards
Saanj
Either you love IT or leave IT...
|
|
|
|
|
s I reading mails from exchange server.
|
|
|
|
|