|
RegisterStartupScript will register your javascript and will call when form gets loaded. i think you are also calling same function on button click event . What you have to do ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Hi all,
i have a page with a button on it, onclick of button i need to get a string data from database and need to write that to a word file. my code is like this:-
1) function:- i am calling this function on button click event after getting my data from database, suppose data is a string "someString".
i am bound to use this approach only because of some specific requirements(can't use word file writing with word application and document object...)
private void html2word(string someString)
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.Buffer = true;
HttpContext.Current.Response.ContentType = "application/msword";
HttpContext.Current.Response.Write(@"");
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename='InvDetails.doc'");
HttpContext.Current.Response.Charset = "utf-8"; //UTF8
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("windows-1250"); //windows-1250
HttpContext.Current.Response.Write("");
HttpContext.Current.Response.Write(someString); HttpContext.Current.Response.Write(" ");
return HttpContext.Current.Response;
// this flush() line of code will ask user to open or save a word file, here only i want to save this file without prompting the user, as this file is going to be deleted after some operation and hence user should not know that it is created... how can we do this
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
}
People often say that motivation doesn't last. Well, neither does bathing - that's why we recommend it daily
Akhilesh Singh
|
|
|
|
|
Hi All,
Is there any relationship between Cookies and Session.Abandon()???
Is am implementing Remember Me on this computer on login page and store the user name and password in Cookies. It works fine if I logout from my site but if I close my application and again run then it doesnot maintain the cookie values.
Please help me...
Thanks in advance...
|
|
|
|
|
Hey sorry for late reply
Can you post the code where you are adding cookie from server side
see this it is working fine in my machine sequence should be like this only specially for expiry i think it should work now
<br />
HttpCookie cookie = new HttpCookie(TxtBxUserName.Text);<br />
Response.Cookies.Add(cookie);<br />
cookie.Values.Add("",TxtBxUserName.Text + "|" + TxtBxPassword.Text + ";");<br />
Response.Cookies[TxtBxUserName.Text].Expires = DateTime.Now.AddDays(15); <br />
<br />
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Hey Sandeep, many many thanks. Its working fine now. Thanks a lot.
|
|
|
|
|
im sorry...but i dont have much experience in this...
but i think u have to use Sesseion.Clear();
coz the Session.Abandon(); will delete the key of ur web.
regards and replay if it is worked
|
|
|
|
|
Hi,
Please can someone give me help with how i go about creating a (pop-up) confirmation box which is activated on page load. If the client clicks 'ok' i need to redirect them to another page, otherwise they are to stay on the current page.
Thanks in advance.
|
|
|
|
|
this.ClientScript.RegisterStartupScript(this.GetType(), "OnLoad", "confirm('really');", true);
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Hi,
How do i add an action if the dialog is confirmed?
Thanks
munklefish
|
|
|
|
|
Instead of writing confirm call a function there in that function write the logic
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Sorry, i dont know what is required.
|
|
|
|
|
this.ClientScript.RegisterStartupScript(this.GetType(), "OnLoad", "functionName();", true);
now write a javascript function
functionName()
{
if(confirm('really do you want...'))
{
write the code when yes is selected
}
else
{
writet the logic when no is seleced
}
}
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
i want to display videos in browser in a website.
any suggestions.........
Do good and have good.
|
|
|
|
|
The easiest way is to use youtube Saves bandwidth
|
|
|
|
|
This all depends on the format of the video as to the exact method.
However it basically intails embedding the appropriate vide player into the html code. This code is available readily on the web, and can be done automatically (i think) via tools such as dreamweaver.
This is assuming you have an pre-encoding video file? If not you will need to encode it to your chosen format using the appropriate encoding tool for the format you wish to use.
However this is essentially quite a basic process, so id be a little concerned that you are asking this in a .Net forum.
munklefish
|
|
|
|
|
hi all
i am buiding page Print image but i dont know how many pixel image if size is A4 or A1, 2,3,4 convert to with and height image
|
|
|
|
|
That's not how it works. You should be able to tell the size of the image the printer can accept, from the printer, and then size your image accordingly. Most printers have huge resolutions, as they are far more than 72 DPI.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
that mean
i am developing module print for map
in the page print u can choose type page so: A4, A3, A2...
when u chose A4 i have set size (width and height) for this image so it accord with type
but i dont know if this A4 or A3 this size of image how much ??
|
|
|
|
|
hi friends
i bind the image in codebehind like this:
but the image is not display
any syntax problem
string bodyHTML = "" +"" + "";
regards
saravan
|
|
|
|
|
Try putting the path in quotes, but it should not matter. Where is the images directory ? Where is this html, relative to that directory ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
This is just a simple case of tinkering with your file paths.
Try:string bodyHTML = "<html><head></head><body>" +"<img src='/images/h.gif'>" + "</body></html>";
Use single quotes around the source location, also try simply putting a '/' before the image location. Some servers are set-up such that they may or not require the prefix of a forward slash.
You could also try using some sort of mappath code to find the true location of your images folder.
munklefish
|
|
|
|
|
Putting an image tag in a string doesn't automatically display the image on the page. What do you do with the string after creating it?
---
single minded; short sighted; long gone;
|
|
|
|
|
It seemed to work okay for me. Make sure your image is in the correct location in the file structure and the name is correct. Otherwise, not sure. Maybe try adding ...what browser are you using?
|
|
|
|
|
I when run the program it shows the date I DD/MM/YYYY
But when I publish it in the IIS server date it shows in the MM/DD/YYYY.
Note : Regional setting in the control panel is set to DD/MM./YYYY.
How to retrieve the date in DD/MM/YYYY after publishing?
thank you
vijaya
|
|
|
|
|
Hi,
I am dynamically creating linkbuttons in asp.net c#. After creating the button i have to assign button click event for which i have written the below code.
btn.Click += new EventHandler(btn_Click);
The same works find when i am writing the code in codebehind but since this code is repeated in all the pages i have to use a class, but the problem is that the btn_Click method is in the codebehind page so how can i assign the eventhandler btn_Click event of the parent page while hooking up the event in the class.
Can someone please help me out.
Please see below the code:
protected void CreatePageCounter()
{
int pagesCount = (int)GetPagesCount();
int linkCount = 0;
for (int i = 1; i <= pagesCount; i++)
{
LinkButton btn = new LinkButton();
btn.Text = i.ToString();
btn.EnableViewState = true;
btn.Click += new EventHandler(btn_Click);
plcHldrPageNo.Controls.Add(btn);
plcHldrPageNo.Controls.Add(new LiteralControl(" "));
linkCount++;
}
}
Regards,
Anees
|
|
|
|