|
Of course, when you're using a hyperlink or a linkbutton you can just set the target, and of course as others have mentioned, there's always javascript. That said, if you really need to use a button, or any other scenario where you want a new window to be fired up from an event handler in your code, this trick might be helpful.
On your page (or on your master page) find the form by its ID:
<br />
HtmlForm frm = Page.FindControl("YourFormID") as HtmlForm;<br />
if (null != frm)<br />
{<br />
frm.Target = "_blank";<br />
}<br />
Hope this helps -
|
|
|
|
|
Hi,
I am exporting some values into excelsheet.
But when i open the excelsheet that time one column is showing some junk data but if i change the format of the cell from the excel then it is showing the correct data.
I implemented export to excel using c# language.
Any idea, how to set the cell format or any other way to show the data correctly with out changing the cell format from the excel.
Thanks In Advance for better solution.
modified on Wednesday, December 2, 2009 6:55 AM
|
|
|
|
|
Assuming you are using excel objects to generate the excel file, you can use the "NumberFormat" property of the desired cell to what ever format you want.
To know what format text to apply, just open an excel sheet, start recording a macro, and set the desired format. You can get the format string from the macro code.
|
|
|
|
|
Junk character means is it something with #### ?
If this is so, it is because the whole data cant be shown because of insufficient space.
It is normal and dont worry, the data is correctly there.
If this is not the case, I think there is some problem. I need to know how are you exporting data to excel then. Is it using OleDb or InterOp ?
|
|
|
|
|
how you're exporting to excel?
Please don't forget to mark 'Good Answer', if you find it really a good one!
Kashif
|
|
|
|
|
I'm working on "forgot password" query in login form in the asp.net. And When I debug the program and write the username in the textbox, click on the submit button , there generates an error "The server rejected one or more recipient addresses. The server response was: 501 5.5.4 Invalid Address"
plz tell me hot to remove that error
|
|
|
|
|
vinci007 wrote: "The server rejected one or more recipient addresses. The server response was: 501 5.5.4 Invalid Address"
The error clearly says that the address you are providing is wrong.
Where is your code for sending mail ?
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
ok..I have taken one textbox in the form ..Coding is:
protected void btnSubmit_Click(object sender, EventArgs e)
{
string qry = "Server=.\\sqlexpress; Initial Catalog=dbLogin; Integrated Security=true";
SqlDataAdapter adp = new SqlDataAdapter("Select Email,(select password from tbLogin where UserName = 'Rahul') as password FROM Details WHERE UserName= 'Rahul'", qry);
DataSet ds = new DataSet();
adp.Fill(ds);
string mailQry = ds.Tables[0].Rows[0]["Email"].ToString();
string pwdQry = ds.Tables[0].Rows[0]["password"].ToString();
MailMessage mailObj = new MailMessage();
mailObj.To = "'" + mailQry + "'";
mailObj.From = "hradmin@ionsoftnet.com";
mailObj.Subject = "Your Password";
mailObj.Body = "'" + pwdQry + "' ";
SmtpMail.SmtpServer = "mail.ionsoftnet.com";
SmtpMail.Send(mailObj);
}
Note: My server address is absolutely right .
what could be the other problem?
|
|
|
|
|
vinci007 wrote: mailObj.To = "'" + mailQry + "'";
What is the value for MailQry ? Try to debug it .
You may also look into this :
http://support.microsoft.com/kb/276866[^]
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
"mailQry" retreives the value from the database. its taking the value as "rahul@ionsoftnet.com" when i'm entering the value "Rahul" in the textBox "txtfrgot"..
|
|
|
|
|
I have created a web service, when i execute the code from Editor in debug mode it works fine without any issue.
But when i run the same code from the Virtual Directory
(http://localhost/service) and try to execute the function, it gives error 500.
Can you please help in resolving the Issue
|
|
|
|
|
Hi Aman,
Does your Virtual Directory configured properly ? You can enable the Custom error mode to check what went wrong in your application.
Thanks !
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
ok..I have taken one textbox in the form ..Coding is:
protected void btnSubmit_Click(object sender, EventArgs e)
{
string qry = "Server=.\\sqlexpress; Initial Catalog=dbLogin; Integrated Security=true";
SqlDataAdapter adp = new SqlDataAdapter("Select Email,(select password from tbLogin where UserName = 'Rahul') as password FROM Details WHERE UserName= 'Rahul'", qry);
DataSet ds = new DataSet();
adp.Fill(ds);
string mailQry = ds.Tables[0].Rows[0]["Email"].ToString();
string pwdQry = ds.Tables[0].Rows[0]["password"].ToString();
MailMessage mailObj = new MailMessage();
mailObj.To = "'" + mailQry + "'";
mailObj.From = "hradmin@ionsoftnet.com";
mailObj.Subject = "Your Password";
mailObj.Body = "'" + pwdQry + "' ";
SmtpMail.SmtpServer = "mail.ionsoftnet.com";
SmtpMail.Send(mailObj);
}
Note: My server address is absolutely right .
what could be the other problem?
|
|
|
|
|
Hi,
Please reply on proper thread !
Thanks !
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Hi! I created a page that has a "Back Button", it opens up as a pop up window. The Back Button doesn't work IE but id does in FireFox Mozilla.
I have tried with window.history.go and window.history.back but non of them is working. Any Suggestion please ?
|
|
|
|
|
What is the error that you get in IE? Check if Pop up is blocked in IE.
BTW, I'm just curious here, why do you want to show a page from the history in a new window?
|
|
|
|
|
Dinesh ! there is no problem with popup blocker. I want to give a back button functionality on popup window same as normal browser window provides.
|
|
|
|
|
I'm sorry, I got it the otherway around!
Do you get any specific error message on IE? What is the server response?
Might sound silly, but check if there are pages in history. Might be there is nothing in history when u tried from IE.
|
|
|
|
|
Dinesh there is no such issue i just want to provide Back Button on popup window same as normal window has
|
|
|
|
|
The point is that the history maintenance is dependent on the browser. As far as I know, IE only maintains the history from the moment the pop-up window is opened.
So, say if you opened your site on the main window and assume this is your page flow
[Main Window] Page1 > Page2 > Page3 > Page4 > [Pop-up] Page5 > Page6
Now from the pop-up you can go back only till Page5. Page1-4 are not accessible from the pop-up.
I think FireFox maintains history differently.
|
|
|
|
|
My application doesn;t have any concern with Page1-4. the concern is if i m on Pag6 and i click Back button the window should take me to the Page5 . which is not happening
|
|
|
|
|
mm, that's interesting! I've never tried putting a back button on a pop-up, so I can't say why it is not happening. BTW, which version of IE r u using? did u try older/newer versions, other machines?
|
|
|
|
|
|
|
ya abhishek i have posted it there too because i didn't get any answer here
|
|
|
|