473,385 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Server control events & client scripts

Hello!

I have a page with a datagrid, where the user can select
an item. Based on the selection of the user, a xml-file is
generated. Some values of the xml-file should be passed to
an application via javascript.

This is what I have done:

--- the source file ---
private void DataGrid1_SelectedIndexChanged(object sender,
System.EventArgs e)
{
// generate MyDocument.xml
string scriptString = "\n<script language=\"javascript\"
id=\"execCodeJS\">\n" +
"doSomething();\n</script>\n";
if (IsClientScriptBlockRegistered("execCodeJS") == false)
{
this.RegisterClientScriptBlock("execCodeJS",
scriptString);
}
}
------

--- the aspx page ---
<xml id="selectionXML" src="MyDocument.xml" />
<script language="javascript" id="clientEventHandlersJS">
function doSomething()
{
var xmlNode;
xmlNode = selectionXML.XMLDocument.selectSingleNode
("these/and_that"); +
alert(xmlNode.text);
}
</script>
------

Unfortunately this does not work.
---
Error: the data necessary to complete this operation is
not yet available.
---
When clicking a button with onclick="doSomething()", the
problem does not occur, everything works fine.

The user selection in the datagrid triggers an event
function.
---
function __doPostBack(eventTarget, eventArgument)
{
// these and that...
theform.submit(); // -> DataGrid1_SelectedIndexChanged
is called
}
---

The following event function would solve my problem:
---
function __doPostBack(eventTarget, eventArgument)
{
// these and that...
theform.submit(); // -> DataGrid1_SelectedIndexChanged
is called
doSomething(); // calling my code
}
---

But how can I get this done?

I am relatively new into web programming, so if there is
better way for solving my problem, please tell me.
Thanks in advance,

Reinhold
Nov 18 '05 #1
1 1022
No, have not resolved this issue. So I'm reposting my request

I have a page with a datagrid, where the user can select
an item. Based on the selection of the user, a xml-file is
generated. Some values of the xml-file should be passed to
an application via javascript

This is what I have done

--- the source file --
private void DataGrid1_SelectedIndexChanged(object sender,
System.EventArgs e

// generate MyDocument.xm
string scriptString = "\n<script language=\"javascript\"
id=\"execCodeJS\">\n" +
"doSomething();\n</script>\n"
if (IsClientScriptBlockRegistered("execCodeJS") == false

this.RegisterClientScriptBlock("execCodeJS",
scriptString)
-----

--- the aspx page --
<xml id="selectionXML" src="MyDocument.xml" /><script language="javascript" id="clientEventHandlersJS"
function doSomething(

var xmlNode
xmlNode = selectionXML.XMLDocument.selectSingleNode
("these/and_that");
alert(xmlNode.text)

</script
-----

Unfortunately this does not work
--
Error: the data necessary to complete this operation is
not yet available
--
When clicking a button with onclick="doSomething()", the
problem does not occur, everything works fine

The user selection in the datagrid triggers an event
function
--
function __doPostBack(eventTarget, eventArgument)

// these and that..
theform.submit(); // -> DataGrid1_SelectedIndexChanged
is calle

--

The following event function would solve my problem
--
function __doPostBack(eventTarget, eventArgument)

// these and that..
theform.submit(); // -> DataGrid1_SelectedIndexChanged
is calle
doSomething(); // calling my cod

--

But how can I get this done

I am relatively new into web programming, so if there is
better way for solving my problem, please tell me

Nov 18 '05 #2

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

Similar topics

4
by: Prodip Saha | last post by:
Dear ASP.NET Gurus, I have a TextBox control with AutoPostBack set to true to execute the server scripts. I also, added some client script for validation.What I want is--execute the client script...
5
by: Mong | last post by:
Hi, I have a webform with various asp controls on it such as textboxes and dropdownlists. I'm fairly new to asp.net coming from VB6 and am wondering when it's best to use client side events and...
2
by: Eli | last post by:
Hello. I have a server side event Page_Load in aspx page. <%@ Page Languadge=c# AutoEventWireup="true" %> <script Languadge=c# runat=server> void Page_Load(Object sender, EventArgs e) { //...
9
by: Mantorok | last post by:
Hi all Is it possible to have client-side scripts executed from server controls, I have a BulletList control and when they click on an item in the list I need some javascript to be executed. ...
22
by: Mr Newbie | last post by:
I was thinking about developing a workflow application yesterday and was musing over the different approaches than one could take in restricting specific actions on a ticket( Form ) at any said...
2
by: Mike | last post by:
Hi, I am strugling with a simple problem which I can't seem to resolve. I have an asp.net page which contains a server-control (flytreeview, which is a kind of a tree to be exact). The tree is...
10
by: Ben | last post by:
Hi, I made an application in classic asp (reservation of books and video stuffs for students) and want to migrate to asp.net. The user has to chose a date, then pushung on a submit button. The...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
2
by: Graville | last post by:
All, OK wasn't sure where to post this one but this should hopefully be ok. I am looking for a way to streamline some of the process within our dev team. One of the areas that often takes time...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...

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.