473,503 Members | 1,646 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using javascrip with datagrid

I can not seem to figure this out, but really haven't work a lot with
javascrip and .NET.

I have a data grid and I want to put a button in it and when the button is
pressed it will call my javascript. Now the grid is in a .ascx file. The
other kicker is I want to also use the databinder property to get a value as
the grid is loading and use that in my java script.

Here is what I have so far as for getting the javascript to do what I want.
the file variable is what needs to use databinder. I guess that is the part
I don't understand. Any help would be greatly appreciated.

TIA,
Brett

<html>
<head>
<script language="JavaScript" type="text/JavaScript">
<!-- Enable Stealth Mode
// Variable Definitions
var nameSpace = null;
var mailFolder = null;
var mailItem = null;
var tempDoc = null;
var outlookApp = null;
var file = null;
var filename = null;
function OpenOutlookDoc(whatform)
{
try
{
file = '\\\\planadmininc.com\\Shareddata\\4most\\proposal s\\M\\ABC
Company, Inc. Safe Harbor 401(k) PS Plan_2.pdf'; (THIS IS WHAT NEEDS TO USE
THE DATABINDER)
filename = 'myfile';
outlookApp = new ActiveXObject("Outlook.Application");
nameSpace = outlookApp.getNameSpace("MAPI");
mailFolder = nameSpace.getDefaultFolder(6);
mailItem = mailFolder.Items.add(whatform);
mailItem.To = "br*********@pai.com";
mailItem.Subject = 'test subject';
mailItem.Body = 'test body';
mailItem.Attachments.Add(file);
mailItem.Display(0)
}
catch(e)
{
// act on any error that you get
}
}
// Disable Stealth Mode -->
</script>
</head>
<body>
<form>
<input type=button value="Send Email" NAME="OutlookOpen1"
OnClick="OpenOutlookDoc('IPM.NOte.FormA')"><br><br >
</form>
</body>
</html>
May 22 '07 #1
3 1790
Hi,
You can use a Templatecolumn and then you can customize the content of it.

Or you can use the Item_DataBound and modify the client onclick event.

"Brett Wesoloski" <br*********@pai.comwrote in message
news:Ou**************@TK2MSFTNGP05.phx.gbl...
>I can not seem to figure this out, but really haven't work a lot with
javascrip and .NET.

I have a data grid and I want to put a button in it and when the button is
pressed it will call my javascript. Now the grid is in a .ascx file. The
other kicker is I want to also use the databinder property to get a value
as the grid is loading and use that in my java script.

Here is what I have so far as for getting the javascript to do what I
want. the file variable is what needs to use databinder. I guess that is
the part I don't understand. Any help would be greatly appreciated.

TIA,
Brett

<html>
<head>
<script language="JavaScript" type="text/JavaScript">
<!-- Enable Stealth Mode
// Variable Definitions
var nameSpace = null;
var mailFolder = null;
var mailItem = null;
var tempDoc = null;
var outlookApp = null;
var file = null;
var filename = null;
function OpenOutlookDoc(whatform)
{
try
{
file = '\\\\planadmininc.com\\Shareddata\\4most\\proposal s\\M\\ABC
Company, Inc. Safe Harbor 401(k) PS Plan_2.pdf'; (THIS IS WHAT NEEDS TO
USE THE DATABINDER)
filename = 'myfile';
outlookApp = new ActiveXObject("Outlook.Application");
nameSpace = outlookApp.getNameSpace("MAPI");
mailFolder = nameSpace.getDefaultFolder(6);
mailItem = mailFolder.Items.add(whatform);
mailItem.To = "br*********@pai.com";
mailItem.Subject = 'test subject';
mailItem.Body = 'test body';
mailItem.Attachments.Add(file);
mailItem.Display(0)
}
catch(e)
{
// act on any error that you get
}
}
// Disable Stealth Mode -->
</script>
</head>
<body>
<form>
<input type=button value="Send Email" NAME="OutlookOpen1"
OnClick="OpenOutlookDoc('IPM.NOte.FormA')"><br><br >
</form>
</body>
</html>

May 22 '07 #2
I have been trying to use the template column with not much luck. Well the
page loads but when the button is clicked it doesn't do anyting.

This is what I have for my template column
<asp:TemplateColumn HeaderText="E-Mail Proposal"
ItemStyle-HorizontalAlign="Center">

<ItemTemplate>

<input type="button" name="email" value= "EMail"
onclick="OpenOutlookDoc('IPM.Note.FormA', '<%#
(DataBinder.Eval(Container.DataItem, "FilenameURL").ToString()) %>')" />

</ItemTemplate>

</asp:TemplateColumn>

Then above in the .ascx I have

<script language="JavaScript" type="text/JavaScript">

<!-- Enable Stealth Mode

// Variable Definitions

var nameSpace = null;

var mailFolder = null;

var mailItem = null;

var tempDoc = null;

var outlookApp = null;

var filename = null;

function OpenOutlookDoc(whatform, file)

{

try

{

filename = 'myfile';

outlookApp = new ActiveXObject("Outlook.Application");

nameSpace = outlookApp.getNameSpace("MAPI");

mailFolder = nameSpace.getDefaultFolder(6);

mailItem = mailFolder.Items.add(whatform);

mailItem.To = "br*********@pai.com";

mailItem.Subject = 'test subject';

mailItem.Body = 'test body';

mailItem.Attachments.Add(file);

mailItem.Display(0)

}

catch(e)

{

// act on any error that you get

}

}

// Disable Stealth Mode -->

</script>

Any idea's why nothing is coming up?

TIA,
Brett

"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in
message news:%2****************@TK2MSFTNGP04.phx.gbl...
Hi,
You can use a Templatecolumn and then you can customize the content of it.

Or you can use the Item_DataBound and modify the client onclick event.

"Brett Wesoloski" <br*********@pai.comwrote in message
news:Ou**************@TK2MSFTNGP05.phx.gbl...
>>I can not seem to figure this out, but really haven't work a lot with
javascrip and .NET.

I have a data grid and I want to put a button in it and when the button
is pressed it will call my javascript. Now the grid is in a .ascx file.
The other kicker is I want to also use the databinder property to get a
value as the grid is loading and use that in my java script.

Here is what I have so far as for getting the javascript to do what I
want. the file variable is what needs to use databinder. I guess that is
the part I don't understand. Any help would be greatly appreciated.

TIA,
Brett

<html>
<head>
<script language="JavaScript" type="text/JavaScript">
<!-- Enable Stealth Mode
// Variable Definitions
var nameSpace = null;
var mailFolder = null;
var mailItem = null;
var tempDoc = null;
var outlookApp = null;
var file = null;
var filename = null;
function OpenOutlookDoc(whatform)
{
try
{
file = '\\\\planadmininc.com\\Shareddata\\4most\\proposal s\\M\\ABC
Company, Inc. Safe Harbor 401(k) PS Plan_2.pdf'; (THIS IS WHAT NEEDS TO
USE THE DATABINDER)
filename = 'myfile';
outlookApp = new ActiveXObject("Outlook.Application");
nameSpace = outlookApp.getNameSpace("MAPI");
mailFolder = nameSpace.getDefaultFolder(6);
mailItem = mailFolder.Items.add(whatform);
mailItem.To = "br*********@pai.com";
mailItem.Subject = 'test subject';
mailItem.Body = 'test body';
mailItem.Attachments.Add(file);
mailItem.Display(0)
}
catch(e)
{
// act on any error that you get
}
}
// Disable Stealth Mode -->
</script>
</head>
<body>
<form>
<input type=button value="Send Email" NAME="OutlookOpen1"
OnClick="OpenOutlookDoc('IPM.NOte.FormA')"><br><b r>
</form>
</body>
</html>


May 22 '07 #3
Hi,

What you see when you select View Source in IE?

Do you get any error? (A yellow icon in the left botton corner of the
browser)

"Brett Wesoloski" <br*********@pai.comwrote in message
news:ud**************@TK2MSFTNGP04.phx.gbl...
>I have been trying to use the template column with not much luck. Well the
page loads but when the button is clicked it doesn't do anyting.

This is what I have for my template column
<asp:TemplateColumn HeaderText="E-Mail Proposal"
ItemStyle-HorizontalAlign="Center">

<ItemTemplate>

<input type="button" name="email" value= "EMail"
onclick="OpenOutlookDoc('IPM.Note.FormA', '<%#
(DataBinder.Eval(Container.DataItem, "FilenameURL").ToString()) %>')" />

</ItemTemplate>

</asp:TemplateColumn>

Then above in the .ascx I have

<script language="JavaScript" type="text/JavaScript">

<!-- Enable Stealth Mode

// Variable Definitions

var nameSpace = null;

var mailFolder = null;

var mailItem = null;

var tempDoc = null;

var outlookApp = null;

var filename = null;

function OpenOutlookDoc(whatform, file)

{

try

{

filename = 'myfile';

outlookApp = new ActiveXObject("Outlook.Application");

nameSpace = outlookApp.getNameSpace("MAPI");

mailFolder = nameSpace.getDefaultFolder(6);

mailItem = mailFolder.Items.add(whatform);

mailItem.To = "br*********@pai.com";

mailItem.Subject = 'test subject';

mailItem.Body = 'test body';

mailItem.Attachments.Add(file);

mailItem.Display(0)

}

catch(e)

{

// act on any error that you get

}

}

// Disable Stealth Mode -->

</script>

Any idea's why nothing is coming up?

TIA,
Brett

"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in
message news:%2****************@TK2MSFTNGP04.phx.gbl...
>Hi,
You can use a Templatecolumn and then you can customize the content of
it.

Or you can use the Item_DataBound and modify the client onclick event.

"Brett Wesoloski" <br*********@pai.comwrote in message
news:Ou**************@TK2MSFTNGP05.phx.gbl...
>>>I can not seem to figure this out, but really haven't work a lot with
javascrip and .NET.

I have a data grid and I want to put a button in it and when the button
is pressed it will call my javascript. Now the grid is in a .ascx file.
The other kicker is I want to also use the databinder property to get a
value as the grid is loading and use that in my java script.

Here is what I have so far as for getting the javascript to do what I
want. the file variable is what needs to use databinder. I guess that
is the part I don't understand. Any help would be greatly appreciated.

TIA,
Brett

<html>
<head>
<script language="JavaScript" type="text/JavaScript">
<!-- Enable Stealth Mode
// Variable Definitions
var nameSpace = null;
var mailFolder = null;
var mailItem = null;
var tempDoc = null;
var outlookApp = null;
var file = null;
var filename = null;
function OpenOutlookDoc(whatform)
{
try
{
file = '\\\\planadmininc.com\\Shareddata\\4most\\proposal s\\M\\ABC
Company, Inc. Safe Harbor 401(k) PS Plan_2.pdf'; (THIS IS WHAT NEEDS TO
USE THE DATABINDER)
filename = 'myfile';
outlookApp = new ActiveXObject("Outlook.Application");
nameSpace = outlookApp.getNameSpace("MAPI");
mailFolder = nameSpace.getDefaultFolder(6);
mailItem = mailFolder.Items.add(whatform);
mailItem.To = "br*********@pai.com";
mailItem.Subject = 'test subject';
mailItem.Body = 'test body';
mailItem.Attachments.Add(file);
mailItem.Display(0)
}
catch(e)
{
// act on any error that you get
}
}
// Disable Stealth Mode -->
</script>
</head>
<body>
<form>
<input type=button value="Send Email" NAME="OutlookOpen1"
OnClick="OpenOutlookDoc('IPM.NOte.FormA')"><br>< br>
</form>
</body>
</html>



May 24 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
945
by: DelphiBlue | last post by:
I have a Nested Datagrid that is using a data relations to tie the parent child datagrids together. All is working well with the display but I am having some issues trying to sort the child...
0
3476
by: Dave | last post by:
Tried posting in the Winform Forum without much luck, so posting here... After inserting a new data row to a DataTable that is bound to a datagrid, I am unable to change data in a row that is...
2
8483
by: Ken Tucker | last post by:
I've read about this issue in many articles across the net... But haven't found a solution. I see all kinds of custom code to perform sorting with datagrids, but my example is so simple, I must...
2
1139
by: Andy Fish | last post by:
Hi, I have some data which is stored as an array (or possibly an arraylist) of identically typed objects, each of which has certain public properties. I want to display these in a datagrid...
2
1840
by: Axel Dahmen | last post by:
Hi, I'm using a DataGrid control to show a table's content with paging. For navigation through the pages I'm using the DataGrid's intrinsic navigation section. My problem: The DataGrid...
1
7330
by: kingster | last post by:
Hi, I have a regular dataset and all i want to do is make a pivot table display in a browser with the datasource of the pivot table to be this dataset and then the end-user will be able to do...
0
2640
by: pedaammulu | last post by:
Hi All, New title for Mastering Web Application Development. All secrets of developing an Accounting Software for the web revealed. Title: "Develop your own Web Accounting Application...
1
12441
by: Ian Davies | last post by:
I am trying to move some text by clicking a button. When clicked the button runs the java script and this will then take the value in the text field and add 10 to it to create a new value, this is...
3
4346
by: rn5a | last post by:
A SqlDataReader is populated with the records from a SQL Server 2005 DB table. The records retrieved depends upon 2 conditions (the conditions depend on what a user selects in an ASPX page). If...
0
7198
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7072
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5570
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4998
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3149
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
373
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.