473,778 Members | 1,759 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="JavaS cript" 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 = '\\\\planadmini nc.com\\Sharedd ata\\4most\\pro posals\\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.Applica tion");
nameSpace = outlookApp.getN ameSpace("MAPI" );
mailFolder = nameSpace.getDe faultFolder(6);
mailItem = mailFolder.Item s.add(whatform) ;
mailItem.To = "br*********@pa i.com";
mailItem.Subjec t = 'test subject';
mailItem.Body = 'test body';
mailItem.Attach ments.Add(file) ;
mailItem.Displa y(0)
}
catch(e)
{
// act on any error that you get
}
}
// Disable Stealth Mode -->
</script>
</head>
<body>
<form>
<input type=button value="Send Email" NAME="OutlookOp en1"
OnClick="OpenOu tlookDoc('IPM.N Ote.FormA')"><b r><br>
</form>
</body>
</html>
May 22 '07 #1
3 1800
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*********@pa i.comwrote in message
news:Ou******** ******@TK2MSFTN GP05.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="JavaS cript" 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 = '\\\\planadmini nc.com\\Sharedd ata\\4most\\pro posals\\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.Applica tion");
nameSpace = outlookApp.getN ameSpace("MAPI" );
mailFolder = nameSpace.getDe faultFolder(6);
mailItem = mailFolder.Item s.add(whatform) ;
mailItem.To = "br*********@pa i.com";
mailItem.Subjec t = 'test subject';
mailItem.Body = 'test body';
mailItem.Attach ments.Add(file) ;
mailItem.Displa y(0)
}
catch(e)
{
// act on any error that you get
}
}
// Disable Stealth Mode -->
</script>
</head>
<body>
<form>
<input type=button value="Send Email" NAME="OutlookOp en1"
OnClick="OpenOu tlookDoc('IPM.N Ote.FormA')"><b r><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:TemplateCo lumn HeaderText="E-Mail Proposal"
ItemStyle-HorizontalAlign ="Center">

<ItemTemplate >

<input type="button" name="email" value= "EMail"
onclick="OpenOu tlookDoc('IPM.N ote.FormA', '<%#
(DataBinder.Eva l(Container.Dat aItem, "FilenameURL"). ToString()) %>')" />

</ItemTemplate>

</asp:TemplateCol umn>

Then above in the .ascx I have

<script language="JavaS cript" 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.Applica tion");

nameSpace = outlookApp.getN ameSpace("MAPI" );

mailFolder = nameSpace.getDe faultFolder(6);

mailItem = mailFolder.Item s.add(whatform) ;

mailItem.To = "br*********@pa i.com";

mailItem.Subjec t = 'test subject';

mailItem.Body = 'test body';

mailItem.Attach ments.Add(file) ;

mailItem.Displa y(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******** ********@TK2MSF TNGP04.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*********@pa i.comwrote in message
news:Ou******** ******@TK2MSFTN GP05.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="JavaS cript" 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 = '\\\\planadmini nc.com\\Sharedd ata\\4most\\pro posals\\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.Applica tion");
nameSpace = outlookApp.getN ameSpace("MAPI" );
mailFolder = nameSpace.getDe faultFolder(6);
mailItem = mailFolder.Item s.add(whatform) ;
mailItem.To = "br*********@pa i.com";
mailItem.Subjec t = 'test subject';
mailItem.Body = 'test body';
mailItem.Attach ments.Add(file) ;
mailItem.Displa y(0)
}
catch(e)
{
// act on any error that you get
}
}
// Disable Stealth Mode -->
</script>
</head>
<body>
<form>
<input type=button value="Send Email" NAME="OutlookOp en1"
OnClick="OpenO utlookDoc('IPM. NOte.FormA')">< br><br>
</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*********@pa i.comwrote in message
news:ud******** ******@TK2MSFTN GP04.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:TemplateCo lumn HeaderText="E-Mail Proposal"
ItemStyle-HorizontalAlign ="Center">

<ItemTemplate >

<input type="button" name="email" value= "EMail"
onclick="OpenOu tlookDoc('IPM.N ote.FormA', '<%#
(DataBinder.Eva l(Container.Dat aItem, "FilenameURL"). ToString()) %>')" />

</ItemTemplate>

</asp:TemplateCol umn>

Then above in the .ascx I have

<script language="JavaS cript" 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.Applica tion");

nameSpace = outlookApp.getN ameSpace("MAPI" );

mailFolder = nameSpace.getDe faultFolder(6);

mailItem = mailFolder.Item s.add(whatform) ;

mailItem.To = "br*********@pa i.com";

mailItem.Subjec t = 'test subject';

mailItem.Body = 'test body';

mailItem.Attach ments.Add(file) ;

mailItem.Displa y(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******** ********@TK2MSF TNGP04.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*********@pa i.comwrote in message
news:Ou******* *******@TK2MSFT NGP05.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="JavaS cript" 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 = '\\\\planadmini nc.com\\Sharedd ata\\4most\\pro posals\\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.Applica tion");
nameSpace = outlookApp.getN ameSpace("MAPI" );
mailFolder = nameSpace.getDe faultFolder(6);
mailItem = mailFolder.Item s.add(whatform) ;
mailItem.To = "br*********@pa i.com";
mailItem.Subjec t = 'test subject';
mailItem.Body = 'test body';
mailItem.Attach ments.Add(file) ;
mailItem.Displa y(0)
}
catch(e)
{
// act on any error that you get
}
}
// Disable Stealth Mode -->
</script>
</head>
<body>
<form>
<input type=button value="Send Email" NAME="OutlookOp en1"
OnClick="Open OutlookDoc('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 datagrid. HTML Datagrid1 TemplateColumn Table Header information Detail Information
0
3504
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 after the newly added row without getting bizarre results. I have added the full code for the test below. Create a project drop in the code and run. There is nothing crazy about the code. I used the designer to add the dataset and to do the...
2
8498
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 just be missing something. Basically, I have a .aspx page that is very simple and has a simple datagrid. All code is in the .cs page for the datagrid (hence, I'm doing all datagrid work programmatically). The datagrid is populated from a SQL table...
2
1150
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 control. According to the documentation, the datasource of a datagrid can be anything which implements IEnumerable (which includes array and arraylist). However, every example I've seen for datagrid uses a DataTable to store the data.
2
1864
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 navigation links use JavaScript to jump between pages. I want them to use standard hyperlinks providing the page number in some URL parameter so that I can copy the hyperlink elsewhere.
1
7355
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 whatever they want ... i dont need to do any special formatting just a straigh ot pivot tables usign sql server, asp.net, vb.net, OWC 10
0
2654
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 using ASP.Net" Price: $19.90 Pages: 300
1
12512
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 then used to move the text (id=h1) to a new position and to display the new value in a text field. My script is below but does not work. Im new to javascrip and there is probably something embarasingly obviour that Im missing. Can anyone help Ian...
3
4370
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 condition1 is true, then the SqlDataReader will be populated with the records existing in table1 & will return 0 to the calling function but if condition2 is true, then the SqlDataReader will be populated with the records from another table named...
0
9628
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9464
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10122
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10061
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8954
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7471
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5368
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2860
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.