|
So you want to use word without automating word
You could try to use an ActiveX-control on the client, but that means you need to automate word...
|
|
|
|
|
Where can you get that ActiveX-control?
|
|
|
|
|
Did you try to google for this?
If you don't find anything, you have to do it on your own...
|
|
|
|
|
You are wasting your time. Just put a link on your page to the file. Put some text next to the link that says "Document will open in MS word. To print file click File > Print."
I didn't get any requirements for the signature
|
|
|
|
|
Cool answer man !!!
Thanks,
Arindam D Tewary
|
|
|
|
|
I like that idea but there are some pitfalls. When you click on the link you are prompted to Open or Save. Can this be turned off so it always opens the document? Once opened the document can be edited. Can it be automatically set to readonly?
|
|
|
|
|
As you are using web application therfore(in first message you have mentioned aspx page ) this
dptalt wrote: When you click on the link you are prompted to Open or Save. Can this be turned off
can not be done as ,as you can not control client's browsers settings.( your concerned document will be opened in client's browser right ?)
dptalt wrote: Once opened the document can be edited
I dont think any browser allows editing word document !!! It can only prompt you that you to open with appropriate document editor software !!!
Thanks,
Arindam D Tewary
|
|
|
|
|
Yes the document opens in the browser, and that is fine. Or can it be directed to open up Word from the windows application?
It must be using Word to open up the document in the browser because there are some editing features available such as I can modify text or bold text. If I navigate away from the page it prompts me if I want to save changes. If I save changes the save as dialog box is displayed.
|
|
|
|
|
It seems to me that you are utterly clueless.
A link to the document will open the document in Word. How else would it work ? And you can't open a document as read only.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
I'm sorry change the message from
"Document will open in MS word. To print file click File > Print." To "(If Prompted) Click Open. Document will open in MS word. To print file click File > Print."
If you want to give the user a read only document I suggest converting it to .pdf first.
I didn't get any requirements for the signature
|
|
|
|
|
Hi friend
I want to know how send to e-mail at particular time. Is web services is use for this process, if yes then how?
please help me
Thanks and Regards
Azad yadav
|
|
|
|
|
azad yadav wrote: I want to know how send to e-mail at particular time. Is web services is use for this process, if yes then how?
If you want send Mail on Particular time, you can go for Windows Service. Which can periodically check you for status and send mail.
Or even you can use SQL Server 2005 to send mail periodically.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Hi all, maybe this questions has been asked before (sorry)
Is it possible to fire fire a C# method (server-side code) from a javascript function (client-side)?
I need to fire some code when user doubles click on datagrid row, something like:
gridview.Cells[index].Attributes.Add("ondblclick". "SomeMethodOnServerSideCode()");
if it was possible, can anyone show me or link me some example?
Thanks!
|
|
|
|
|
You can not directly fire a server side code from client side code by adding ANY event handler by adding it to attribute collection.
From client side code, only doPostBack function can fire a server side event handler.
So you need to call that _doPostback() function and sent the cooecr parameter so that doPostBack() function can fire a server side event handler.
Thanks,
Arindam D Tewary
|
|
|
|
|
Yes, I know an easy hack for this.
Drag a button onto your form.
Double click the button in design view to get your method. Put your server code there.
Add the following javascript to your page mark up.
function callServerEvent() {<br />
<br />
var Button1 = document.getElementById"<%= Button1.ClientID %>");<br />
Button1.click();<br />
}
in the page_load add the following
this.Button1.Style.Add("display", "none");
use the callServerEvent() method in your javascript code.
I didn't get any requirements for the signature
|
|
|
|
|
Hi ToddHileHoffer
ToddHileHoffer wrote: Double click the button in design view to get your method. Put your server code there.
Here actually you are directly adding a server side event handler. This implicitly calls _doPostback function of with proper eventTarget and _eventArgument value.
ToddHileHoffer wrote: Button1.click();
ToddHileHoffer wrote: use the callServerEvent() method in your javascript code.
If I add this callServerEvent() method also, from where you want to call this javascript function so that you epect to fire server side event !!! ???
Thanks,
Arindam D Tewary
|
|
|
|
|
Arindam Tewary wrote: Here actually you are directly adding a server side event handler. This implicitly calls _doPostback function of with proper eventTarget and _eventArgument value.
Yes. This is a very easy way of doing this.
Arindam Tewary wrote: If I add this callServerEvent() method also, from where you want to call this javascript function so that you epect to fire server side event !!! ???
You can use callServerEvent() in your javascript code anywhere you want.
And as an added bonus. If you put the Button1 inside an ajax panel your server event will fire via ajax and the page will not postback!
I put together an example for you.
<br />
<br />
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><br />
<br />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br />
<html xmlns="http://www.w3.org/1999/xhtml"><br />
<head runat="server"><br />
<title></title><br />
<br />
<script type="text/javascript" ><br />
function callServerEvent() {<br />
<br />
var Button1 = document.getElementById("<%= Button1.ClientID %>");<br />
Button1.click();<br />
}<br />
<br />
</script><br />
<br />
<script type="text/C#" runat="server"><br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
if (!IsPostBack)<br />
{<br />
this.Button1.Style.Add("display", "none");<br />
}<br />
}<br />
protected void Button1_Click(object sender, EventArgs e)<br />
{<br />
this.lblResult.Text = "Server code executed at " + DateTime.Now.ToLongTimeString();<br />
}<br />
</script><br />
</head><br />
<body><br />
<form id="form1" runat="server"><br />
<asp:ScriptManager ID="ScriptManager1" runat="server"><br />
</asp:ScriptManager><br />
<div><br />
<br /><br />
This is an example of an easy way to call a server method from javascript.<br />
<br /><br />
<br /><br />
<asp:UpdatePanel ID="UpdatePanel1" runat="server"><br />
<ContentTemplate><br />
<asp:Label runat="server" ID="lblResult"></asp:Label><br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /><br />
</ContentTemplate><br />
</asp:UpdatePanel><br />
</div><br />
</form><br />
<p><br />
</p><br />
<p><br />
<input id="Button2" type="button" value="Call Server Code From Javascript" onclick="callServerEvent();" /></p><br />
</body><br />
</html><br />
<br />
I didn't get any requirements for the signature
modified on Thursday, April 16, 2009 10:25 AM
|
|
|
|
|
Hi
I tried your instruction but not sure whether I have exactly been able to achieved that ,
here is my code ,
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
</div>
<script language="javascript">
function callServerEvent()
{
var Button1 = document.getElementById("<%= Button1.ClientID %>");
Button1.click();
}
</script>
</form>
</body>
</html>
See here, I didnt call this javascript function "callServerEvent()" from anywhere.
So I guess, thats not gets called at all.
If so how we have called the server side event handler from client side code?
Please comment on this if I am missing anything !!!
Thanks,
Arindam D Tewary
|
|
|
|
|
I edited the post above this with an example. Does that make sense?
I didn't get any requirements for the signature
|
|
|
|
|
This is really very strange that you are actually calling "Button1_Click" which is a server side event handler of "Button1" with so much hassle. You are calling Button1's event handler by Clikcing (firing client side event handler of Button2) "Button2". This is really not proper at all.
The whole thing which you have shown is equivalent to just clicking a server side asp.net button(yes as simple as that )
and a server side asp.net button actually calls the same _doPostback internally ( you never need to know that, actually when you use asp.net server side button !!! )
I am really not getting you theory at all !!!
Please correct me if I am wrong ....
Thanks,
Arindam D Tewary
|
|
|
|
|
You are correct in that you would never do what I just did, it would be pointless. The point was to show how to call server code from javascript. The idea here is that you can call the server code without a control.
Now he can do it. The code below would execut the server code in the Button1_Click event.
gridview.Cells[index].Attributes.Add("ondblclick". "callServerEvent();");
Another example: say you are using the modal popup window in the ajax toolkit and you want to update your form when the window is closed.
You could set OnOkScript="callServerEvent();" and then you can run server side code when your window is closed.
I didn't get any requirements for the signature
|
|
|
|
|
when we create project just choosing option like Web Site project then dll is not created until we publish the whole site. so please tell me in which situation a user should choose Web Site project and why the dll file is not create if user choose Web Site project type.
tbhattacharjee
|
|
|
|
|
Check this MSDN[^] article.
|
|
|
|
|
hi to all
how can i get the client id in .net
html source:
<input type="button" id="button1" class="buttonsT" name="inputval30something^&()%#@!sabs" value="30 Something(1494)" title="Click this Button to log in as 30 Something(1494)" onclick="loginas('30something^&()%#@!sabs');">
this entirly bind in xslt..not in html
Known Is Drop.Unknown Is Ocean
|
|
|
|
|
saravanan05 wrote: how can i get the client id in .net
var id= document.getElementById(button1);
cheers,
Abhijit
CodeProject MVP
|
|
|
|