AjaxPro Framework hitting timeout function? - asp.net-2.0

I am trying to develop a chat application.I am using Asp.Net2.0 and vs2005.Iam using AjaxPro Framework for getting asynchronous calls to the server side.
My problem is when i send message im getting timeout error after a few seconds.What could be the problem and how will i resolve it?
My another doubt is that is there some serious problem in using AjaxPro Framework
Heres the code i have used in the client side to send messages
<script language="javascript">
// Send messages
function sendMessage()
{
// input box for entering message
var ta_content = el("txtcontent");
// if the content input is not empty
if (ta_content.value.length > 0)
{
//the message show area
var div_recentMsg = el("recentMsg");
var clientUname=document.getElementById("<%=hFieldClientUserName.ClientID %>").value;
var adminUname=document.getElementById("<%=hFieldAdminUserName.ClientID %>").value;
// send the message
AjaxProChat.SendMessage(clientUname,adminUname,ta_content.value);
// clear the input box
ta_content.value = "";
// roll up the web page with the messages
ta_content.scrollIntoView(false);
getNewMessage();
}
}
//Obtain the new messages
function getNewMessage()
{
// AjaxProChat.timeouPeriod(1800000);
// the user name
var username = document.getElementById("<%=hFieldClientUserName.ClientID %>").value;
// the message show area
var div_recentMsg = el("recentMsg");
// Obtain the DataTable for the newest messages
var dt = AjaxProChat.GetNewMsg(username).value;
for (var i = 0;i < dt.Rows.length;i++)
{
// one message in response to one <span> object
var oneMsg = document.createElement("span");
// the message sender and corresponding sent content
var strLine1 = dt.Rows[i].Sender + " says: (" + dt.Rows[i].SendTime + ")";
strLine1 = DealBrackets(strLine1);
// the content of the message
var strLine2 = dt.Rows[i].Contents;
strLine2 = DealBrackets(strLine2);
// show style
oneMsg.innerHTML = "<pre>" + strLine1 + "<br> " + strLine2 + "</pre>";
oneMsg.style.padding = "2px 2px 2px 2px";
oneMsg.style.color = (dt.Rows[i].Sender == username) ? "blue" : "red";
oneMsg.style.fontFamily = "'Courier New'";
// attached to DOM
div_recentMsg.appendChild(oneMsg);
}
}
</script>
Heres the html code
<div style="text-align: center">
<strong><span style="font-size: 24pt"><span style="color: #333399; background-color: #ffffff">
Chatting Room</span></span></strong>
</div>
<table border="2" style="width: 792px; height: 443px;background-color:#ffffff;">
<tr>
<td colspan="3" style="height: 373px; width: 729px;">
<div id="recentMsg" style="width: 779px; height: 368px; overflow:auto;">
</div>
</td>
</tr>
<tr>
<td colspan="3" style="height: 30px; width: 729px;">
<asp:Label ID="Label1" runat="server" Font-Size="X-Large" ForeColor="Maroon">Input the message and click Send or press ENTER key:</asp:Label>
</td>
</tr>
<tr>
<td colspan="3" style="height: 40px; width: 729px;">
<input id="txtcontent" onkeydown="if (event.keyCode==13) {sendMessage();return false;}"
style="width: 55%; height: 30px" type="text" runat="server" />
<input onclick="javascript:sendMessage();" style="width: 58px; border-top-style: groove;
border-right-style: groove; border-left-style: groove; background-color: #ebf1fa;
border-bottom-style: groove; height: 34px;" type="button" value="Send" id="btnSend" /></td>
</tr>
<tr>
<td colspan="3" style="width: 729px">
</td>
</tr>
</table>
Heres the code for sending and receving messages i have written in server side
[AjaxPro.AjaxMethod]//code for sending messages
public void SendMessage(string Sender,string Receiver,string Content)
{
ChatBAL clsChat = new ChatBAL();
clsChat.SENDER = Sender;
clsChat.RECEIVER = Receiver;
clsChat.CONTENT = Content;
clsChat.SendMessage();
}
[AjaxPro.AjaxMethod]//code for getting latest message and returns datatable
public DataTable GetNewMsg(string UserName)
{
ChatBAL clsChat = new ChatBAL();
DataTable dtNewMsg =new DataTable();
try
{
clsChat.USERNAME = UserName;
dtNewMsg = clsChat.GetNewMessage();
}
catch
{
throw;
}
finally
{
clsChat = null;
}
return dtNewMsg;
}

In your javascript code, you can use this code right before of the ajax call.
AjaxPro.timeoutPeriod = 120 * 1000; //this will add a 2 minutes timeout
AjaxPro.onTimeout = (function (time, obj, something) {
if (time < AjaxPro.timeOutPeriod || obj.method !="SendMessage") return false;
else
{
console.log("Ajaxpro timeout exception after 120 seconds!");
}
});

Related

Google Maps V3 API not working in MVC5

I am new to ASP.NET MCV5 and trying to add Google Maps to get direction from my current position to some destination.
The code below is working fine when I am running it alone in an html file but not working in ASP.NET MVC5 project in .cshtml view. I tried to change http to https in in Google Maps library as suggested in another question, but it is still not working. Any suggestions, please.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
body
{
font-family: Arial;
font-size: 10pt;
}
</style>
</head>
<body>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places"></script>
<script type="text/javascript">
var source, destination;
var directionsDisplay;
var directionsService = new google.maps.DirectionsService();
google.maps.event.addDomListener(window, 'load', function () {
new google.maps.places.SearchBox(document.getElementById('txtSource'));
new google.maps.places.SearchBox(document.getElementById('txtDestination'));
directionsDisplay = new google.maps.DirectionsRenderer({ 'draggable': true });
});
function GetRoute() {
var mumbai = new google.maps.LatLng(18.9750, 72.8258);
var mapOptions = {
zoom: 7,
center: mumbai
};
map = new google.maps.Map(document.getElementById('dvMap'), mapOptions);
directionsDisplay.setMap(map);
directionsDisplay.setPanel(document.getElementById('dvPanel'));
//*********DIRECTIONS AND ROUTE**********************//
source = document.getElementById("txtSource").value;
destination = document.getElementById("txtDestination").value;
var request = {
origin: source,
destination: destination,
travelMode: google.maps.TravelMode.DRIVING
};
directionsService.route(request, function (response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
//*********DISTANCE AND DURATION**********************//
var service = new google.maps.DistanceMatrixService();
service.getDistanceMatrix({
origins: [source],
destinations: [destination],
travelMode: google.maps.TravelMode.DRIVING,
unitSystem: google.maps.UnitSystem.METRIC,
avoidHighways: false,
avoidTolls: false
}, function (response, status) {
if (status == google.maps.DistanceMatrixStatus.OK && response.rows[0].elements[0].status != "ZERO_RESULTS") {
var distance = response.rows[0].elements[0].distance.text;
var duration = response.rows[0].elements[0].duration.text;
var dvDistance = document.getElementById("dvDistance");
dvDistance.innerHTML = "";
dvDistance.innerHTML += "Distance: " + distance + "<br />";
dvDistance.innerHTML += "Duration:" + duration;
} else {
alert("Unable to find the distance via road.");
}
});
}
</script>
<table border="0" cellpadding="0" cellspacing="3">
<tr>
<td colspan="2">
Source:
<input type="text" id="txtSource" value="Bandra, Mumbai, India" style="width: 200px" />
Destination:
<input type="text" id="txtDestination" value="Andheri, Mumbai, India" style="width: 200px" />
<br />
<input type="button" value="Get Route" onclick="GetRoute()" />
<hr />
</td>
</tr>
<tr>
<td colspan="2">
<div id="dvDistance">
</div>
</td>
</tr>
<tr>
<td>
<div id="dvMap" style="width: 500px; height: 500px">
</div>
</td>
<td>
<div id="dvPanel" style="width: 500px; height: 500px">
</div>
</td>
</tr>
</table>
<br />
</body>
</html>
click F12 check in console what error is showing .This google map api may required Google API Key.But it is working fine in .cshtml

Fixing table header on webpage

I would like to know how to fix a table header even if we scroll down on a website and out of the table view.
I would like to use css style to do this. Thank you.
I would also like to know how to fix an element on a webpage so it always appears even when we scroll down. The image can be text. Use div and css
You would do something like this by tapping into the scroll event handler on window, and using another table with a fixed position to show the header at the top of the page.
Example:
var tableOffset = $("#table-1").offset().top;
var $header = $("#table-1 > thead").clone();
var $fixedHeader = $("#header-fixed").append($header);
$(window).bind("scroll", function() {
var offset = $(this).scrollTop();
if (offset >= tableOffset && $fixedHeader.is(":hidden")) {
$fixedHeader.show();
}
else if (offset < tableOffset) {
$fixedHeader.hide();
}
});
body { height: 1000px; }
#header-fixed {
position: fixed;
top: 0px; display:none;
background-color:white;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table id="table-1">
<thead>
<tr>
<th>Header1</th>
<th>Header2</th>
<th>Header3</th>
</tr>
</thead>
<tbody>
<tr>
<td>info</td>
<td>info</td>
<td>info</td>
</tr>
<tr>
<td>info</td>
<td>info</td>
<td>info</td>
</tr>
<tr>
<td>info</td>
<td>info</td>
<td>info</td>
</tr>
</tbody>
</table>
<table id="header-fixed"></table>
Taken from an old post of mine, here's an example of both things that you want done together in one fiddle.
JSFiddle
JQuery:
function moveScroll() {
var scroll = $('#table-container').offset().top;
var anchor_top = $("#maintable").offset().top;
var anchor_bottom = $("#bottom_anchor").offset().top;
if (scroll > anchor_top && scroll < anchor_bottom) {
clone_table = $("#clone");
if (clone_table.length === 0) {
clone_table = $("#maintable").clone();
clone_table.attr({
id: "clone"
}).css({
position: "fixed",
"pointer-events": "none",
left: $("#maintable").offset().left + 'px',
top: 130
}).width($("#maintable").width());
$("#table-container").append(clone_table);
$("#clone").width($("#maintable").width());
$("#clone thead").css({
visibility: "true"
});
$("#clone tbody").css({
visibility: "hidden"
});
var footEl = $("#clone tfoot");
if (footEl.length) {
footEl.css({
visibility: "hidden"
});
}
}
} else {
$("#clone").remove();
}
}
$('#table-container').scroll(moveScroll);

How to capture table row on button click to add css class knockout js

i have table with data and data populated by knockout js foreach bind.
i would like to know how to access specific table row's data when it gets updated.
if i could access table row then could add css class to that tr. my objective is to do bit color animation for a row which will be updated just clicking on button. when any data will be push to table row clicking on "Update Data" button then i want to add a class to that table row and after few minute remove that class too. hence i am new so no logic is coming to my mind to achieve this....any help would be appreciated. thanks
jsfiddle http://jsfiddle.net/62Ls6x9n/157/
full code
<button data-bind="click: AddNewData">Add New Data</button>
<button data-bind="click: UpdateDataByIds">Update Data</button>
<br><br>
<table class="imagetable">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Price</th>
<th>Status</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody data-bind="foreach: Stocks">
<tr>
<td data-bind="text: id"></td>
<td data-bind="text: name"></td>
<td data-bind="text: price"></td>
<td data-bind="text: status"></td>
<td>edit</td>
<td>delete</td>
</tr>
</tbody>
</table>
table.imagetable {
font-family: verdana,arial,sans-serif;
font-size:11px;
color:#333333;
border-width: 1px;
border-color: #999999;
border-collapse: collapse;
}
table.imagetable th {
background:#b5cfd2 url('cell-blue.jpg');
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #999999;
}
table.imagetable td {
background:#dcddc0 url('cell-grey.jpg');
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #999999;
}
var StockItem = function(_id, _name, _price, _status){
var self = this;
self.id = ko.observable(_id);
self.name = ko.observable(_name);
self.price = ko.observable(_price);
self.status = ko.observable(_status);
};
var data= [
new StockItem("12345", "Acme Widget 1", "£25.99", "In Stock"),
new StockItem("67890", "Acme Widget 2", "£28.99", "In Stock"), new StockItem("11123","Acme Widget 3","£15.99", "In Stock"),
new StockItem("14156", "Acme Widget 4", "£33.99", "In Stock")
];
var NewData = [new StockItem("99999", "HSL Limited", "£78.99", "In Stock")];
var appViewModel = function()
{
var self = this;
self.Stocks = ko.observableArray(data);
self.AddNewData = function(){
self.Stocks.push.apply(self.Stocks,NewData);
};
self.DeleteItem = function(dataContext){
var itemToDelete = dataContext;
self.Stocks.remove(itemToDelete);
}
self.UpdateDataByIds = function(){
var id1 = '11123';
var id2 = '12345';
self.UpdateById(id1,null,null,"Out of Stock");
self.UpdateById(id2,null,"31.45",null);
};
self.UpdateById = function(_id, _name, _price, _status){
var matchedItem = ko.utils.arrayFirst(self.Stocks(), function(item) {
return item.id() === _id;
});
if (matchedItem != null){
if (_name != null) matchedItem.name(_name);
if (_price != null) matchedItem.price(_price);
if (_status != null) matchedItem.status(_status);
}
};
self.UpdateData = function(dataContext){
var itemToEdit = dataContext;
itemToEdit.status("Out of Stock");
};
};
var vm = new appViewModel();
ko.applyBindings(vm);
You can add a Mutated array to your view-model:
self.Mutated = ko.observableArray();
And upon updating / adding, add the item id to the array:
self.Mutated.push(_id);
Then in your HTML, have a mutated class on each <TR> that is indeed mutated:
<tr data-bind="css: { mutated: $root.Mutated.indexOf(id()) > -1 }">
And the CSS:
table.imagetable tr.mutated td { background-color: red; }
See Fiddle

Asp.net Async page that call a Web Service Without use Visual Studio web reference

i need to call a web service without use webreference created with visual studio, i have to use
http web request i have the soap request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pos="http://posting.ws.rpg.snamretegas.it/">
<soapenv:Header/>
<soapenv:Body>
<pos:postAllReports>
<report_name>REPORT_SWITCH</report_name>
<report_date></report_date>
<i_ambiente>ITG1</i_ambiente>
<i_taxidOpco>TEST_YF1</i_taxidOpco>
</pos:postAllReports>
</soapenv:Body>
</soapenv:Envelope>
this is the code behind asp page:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.OracleClient;
public partial class PubreportControl : System.Web.UI.Page
{
private DB_Utility dbu;
protected double size = 1;
private string connectionString;
private OracleConnection connection;
private OracleCommand processNumQuery;
private int indexdropitem;
private int coloreriga = 1;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Session["CONNECTSTRING"] = Request["CONNECTSTRING"];
if (Session["CONNECTSTRING"] == null)
{
Response.Redirect("sessionup.asp?type=Pubreport");
}
connectionString = Session["CONNECTSTRING"].ToString();
if (connectionString.IndexOf("DSN=") >= 0)
{
Comuni.Utility util = new Utility();
connectionString = util.ConnStr(connectionString);
Session["CONNECTSTRING"] = connectionString;
}
connection = new OracleConnection(connectionString);
connection.Open();
dbu = new DB_Utility(Session["CONNECTSTRING"].ToString());
}
else
{
connectionString = Session["CONNECTSTRING"].ToString();
if (connectionString.IndexOf("DSN=") >= 0)
{
Comuni.Utility util = new Utility();
connectionString = util.ConnStr(connectionString);
Session["CONNECTSTRING"] = connectionString;
}
connection = new OracleConnection(connectionString);
connection.Open();
dbu = new DB_Utility(Session["CONNECTSTRING"].ToString());
}
if (!IsPostBack)
{
processNumQuery = new OracleCommand("select distinct nome_report from rpg_notification",connection);
OracleDataReader reader = processNumQuery.ExecuteReader();
while (reader.Read())
{
dropdownlist1.Items.Insert(0, new ListItem(reader.GetString(0), reader.GetString(0)));
}
reader.Close();
}
if(Request["txtSchedDate"] == null)
{
DateTime daDate = DateTime.Today;
txtSchedDate.Text = daDate.ToString("dd/MM/yyyy");
}
else
{
txtSchedDate.Text = Request["txtSchedDate"];
gwreportpub.DataSource = getDatiFromDb();
gwreportpub.DataBind();
DateTime schedDate = Convert.ToDateTime(Request["txtSchedDate"]);
string reportname = dropdownlist1.SelectedItem.Text;
object[] WSMethodArguments = new object[3];
WSMethodArguments[0] = reportname;
WSMethodArguments[1] = schedDate.ToUniversalTime().ToString("s");
WSMethodArguments[2] = "ITG1";
PageAsyncTask task = new PageAsyncTask(
new BeginEventHandler(BeginAsyncOperation),
new EndEventHandler(EndAsyncOperation),
new EndEventHandler(TimeoutAsyncOperation),
WSMethodArguments
);
RegisterAsyncTask(task);
}
}
protected void Button1_Click(object sender, EventArgs e)
{
//Response.Write("ciao " + dropdownlist1.SelectedIndex + " - " + dropdownlist1.SelectedItem.Text + " - " + dropdownlist1.Items[dropdownlist1.SelectedIndex].Text + " - " + Request["txtSchedDate"] + " - ");
//ThreadPool.QueueUserWorkItem(new WaitCallback(callWebService),new object[] {"http://172.19.241.235:9001/snam-rpg-ws/ReportPosting","ReportPosting","postAllReports",WSMethodArguments});
gwreportpub.DataSource = getDatiFromDb();
gwreportpub.DataBind();
gwreportpub.Visible = true;
if (gwreportpub.Rows.Count == 0)
{
tbnotif.Text = "Non vi sono report pubblicati";
tbnotif.Visible = true;
}
else{
tbnotif.Visible = true;
tbnotif.Text = "Tabella dei Report Pubblicati: ";
}
return;
}
void TimeoutAsyncOperation(IAsyncResult ar)
{
Response.Write("Pubblicazione Timeout");
}
IAsyncResult BeginAsyncOperation (object sender, EventArgs e,
AsyncCallback cb, object state)
{
object[] array = state as object[];
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(#"http://172.19.241.235:9001/snam-rpg-ws/ReportPosting");
webRequest.Headers.Add(#"SOAP:Action");
webRequest.ContentType = "text/xml;charset=\"utf-8\"";
webRequest.Accept = "text/xml";
webRequest.Method = "POST";
HttpWebRequest request = webRequest;
XmlDocument soapEnvelopeXml = new XmlDocument();
soapEnvelopeXml.LoadXml("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:pos=\"http://posting.ws.rpg.snamretegas.it/\"><soapenv:Header/><soapenv:Body><pos:postAllReports><report_name> " + array[0] +" </report_name> <report_date> " + array[1] + "</report_date> <i_ambiente> " + array[2] + "</i_ambiente> <i_taxidOpco></i_taxidOpco></pos:postAllReports></soapenv:Body></soapenv:Envelope>");
using (Stream stream = request.GetRequestStream())
{
soapEnvelopeXml.Save(stream);
}
using (WebResponse response = request.GetResponse())
{
using (StreamReader rd = new StreamReader(response.GetResponseStream()))
{
string soapResult = rd.ReadToEnd();
}
}
SampleMethodCaller smd = new SampleMethodCaller(SampleClass.SampleMethod);
IAsyncResult result = smd.BeginInvoke(null, null);
return result;
//return callWebService(new object[] {"http://172.19.241.235:9001/snam-rpg-ws/ReportPosting","ReportPosting","postAllReports",state});
}
public delegate bool SampleMethodCaller();
void EndAsyncOperation(IAsyncResult ar)
{
Response.Write("Pubblicazione Terminata");
}
protected void Page_PreRenderComplete(object sender, EventArgs e)
{
}
public DataSet getDatiFromDb()
{
OracleDataAdapter adapter = new OracleDataAdapter();
OracleCommand orclc = new OracleCommand("select pubblicato, nome_report, data_report, md5 from rpg_notification where pubblicato = :flag and data_report <= TO_DATE(:repdate,'DD/MM/YYYY') and nome_report = :nome",this.connection);
orclc.Parameters.Add(new OracleParameter(":flag", OracleType.VarChar));
orclc.Parameters.Add(new OracleParameter(":nome", OracleType.VarChar));
orclc.Parameters.Add(new OracleParameter(":repdate", OracleType.VarChar));
orclc.Parameters[":flag"].Value = "Y";
orclc.Parameters[":nome"].Value = dropdownlist1.SelectedItem.Text;
orclc.Parameters[":repdate"].Value = Request["txtSchedDate"].ToString();
adapter.SelectCommand = orclc;
DataSet dt = new DataSet("rpg_notification");
adapter.Fill(dt,"rpg_notification");
return dt;
}
protected void GridView1_PageIndexChanging(object sender,
GridViewPageEventArgs e)
{
gwreportpub.PageIndex = e.NewPageIndex;
gwreportpub.DataBind();
}
protected void coloraRighe(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType==DataControlRowType.Header)
{
e.Row.BackColor = Color.Ivory;
}
else if (coloreriga == 2)
{
e.Row.BackColor = Color.LightYellow;
coloreriga = 1;
}
else
{
e.Row.BackColor = Color.WhiteSmoke;
coloreriga = 2;
}
}
}
public class SampleClass
{
public static bool SampleMethod()
{
return true;
}
}
please can you tell me why it dose not call the Ws ???
and please how can i debug this ??? you see something wrong in the code ??
i m getting crazy about the async pattern too
in the end the asp page:
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Pubreport.aspx.cs"
Inherits="PubreportControl" Title="Untitled Page" Async="true" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<script language="javascript" type="text/javascript">
var size = 0;
var id= 0;
function add_gif() {
document.getElementById("Label1").style.display = "none";
show_image("./wait.gif", 300,15, "Running");
}
function show_image(src, width, height, alt) {
var img = document.createElement("img");
img.src = src;
img.width = width;
img.height = height;
img.alt = alt;
document.getElementById("divUpload").style.display="inline";
var div = document.getElementById("divUpload");
div.appendChild(img);
}
function show_table() {
document.getElementById("tbnotification").style.display="block";
}
</script>
<head id="Head1" runat="server">
<title>Pubblicazione Report</title>
<link rel="stylesheet" type="text/css" href="../controls/SnapIn.css" />
<link rel="stylesheet" type="text/css" href="../controls/lsi18n.css" />
<script type="text/javascript" src="../cust_batchrequest/calendario/prototype.js"></script>
<script type="text/javascript" src="../cust_batchrequest/calendario/scriptaculous.js"> </script>
<script type="text/javascript" src="../cust_batchrequest/calendario/datepicker.js"></script>
<link rel="stylesheet" type="text/css" href="../cust_batchrequest/calendario/datepicker.css" />
<style type="text/css">
.errorMessage
{
color: #8B0000;
text-align: center;
}
.confirmMessage
{
color: #006400;
text-align: center;
}
.datebox
{
text-align:center;
}
</style>
<style type="text/css">
.CCSListBox
{
width: 200px;
}
</style>
</head>
<body style="margin-left: 20%; margin-right: 20%">
<form id="form1" runat="server">
<table class="SnapIn" style="text-align: center; height: 100%; border: 0; background-color: #FFFFFF; width: 100%;
border: 3px solid #6699CC" cellpadding="0" cellspacing="0">
<tr class="ToolsRow">
<td class="Title" style="white-space: nowrap; width=20%">
Pubblicazione Report
</td>
<td style="width: 80%; text-align: right">
</td>
</tr>
<tr style="height: 5%">
<td colspan="2">
</td>
</tr>
<tr style="text-align: center;">
</tr>
<tr style="height: 15%">
<td colspan="2">
</td>
</tr>
<tr>
<td style="text-align: center" colspan="2">
<div style="text-align:center">
<b>Scegliere il nome del report * </b>
<asp:DropDownList id="dropdownlist1" style="width:250px;" runat="server"></asp:DropDownList>
<br />
<br />
<br />
<b>Scegliere la data del report </b>
<asp:TextBox runat="server" ID="txtSchedDate" name="txtSchedDate" type="text" cssclass="datebox" style="height:20px;" ReadOnly="true"/>
<br />
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Pubblica" OnClientClick="show_table();" OnCommand="Button1_Click" />
<br />
<br />
<br />
<br />
<asp:Label ID="Label1" Font-Names="Arial" Font-Size="15px" runat="server" ForeColor="Red" Font-Bold="True" Text=""></asp:Label>
<div id="divUpload" style="display:none">
<div style="width:200pt;;text-align:center;">Pubblicando...</div>
</div>
</div>
</td>
<br/>
</tr>
<tr>
<td colspan="2" style="text-align: center">
<br />
</td>
</tr>
<tr>
<td colspan="2" style="text-align: center">
<br />
<table width="100%" id="tbnotification" class="Stripy" style="display:block;">
<tr>
<tr>
<td colspan="2" style="text-align: center">
<asp:Label ID="tbnotif" runat="server" ReadOnly="True" Text="" >
</asp:Label>
</td>
</tr>
<tr>
<td>
<asp:GridView ID="gwreportpub" runat="server" CellPadding="5" BorderStyle="Solid" OnRowDataBound="coloraRighe" AllowPaging="true" PageSize="15" OnPageIndexChanging="GridView1_PageIndexChanging" style="border: 1px solid black;">
</asp:gridview>
</td>
</tr>
</tr>
</table>
</td>
</tr>
</table>
</form>
<script type="text/javascript">
var dpck_1 = new DatePicker({ relative: 'txtSchedDate', language: 'it' });
</script>
ok did an external client in java and i did produce a jar that call the webservice
after i did this for call the webserice inside the aspx page:
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.FileName = "\"" + System.Web.HttpContext.Current.Server.MapPath(".") + "\\" + "ConsoleApp.jar" + "\"" ;
if(datarepo != "")
proc.StartInfo.Arguments = "\""+connectionString +"\"" + " " +"\"" +reportname+"\"" + " " +"\"" +datarepo+"\"" + " " +"\"" +opco+"\"" + " " + "\"" +ambienteParm+"\"";
else
proc.StartInfo.Arguments = "\""+connectionString +"\"" + " " +"\"" +reportname+"\"" + " " +"\"" + "\"" + " " +"\"" +opco+"\"" + " " + "\"" +ambienteParm+"\"";
proc.Start();
proc.WaitForExit();
//string result = proc.StandardOutput.ReadToEnd();
//Response.Write(result + " - " + proc.ExitCode);
proc.Close();
thxs to everyone.

Table sorter icons in thead

I have some JavaScript that toggles the class of the th element clicked to "ascending" or "descending".
Q: In the css, how can I display a jQuery-UI icon associated with .ascending or .descending?
<table>
<thead>
<tr>
<th class="ascending">Cust</th>
<th>Name</th>
</tr>
</thead>
...
</table>
Here's the code, just in case someone spots an inefficiency:
jQuery(function($) {
$('.thSort th').click(function() {
var $th = $(this);
$th.siblings().removeClass('selected ascending descending');
$th.addClass('selected');
var column = $th.index();
var $table = $th.closest('table');
var rows = $table.find('tbody > tr').get();
if ($th.hasClass('ascending')) {
$th.removeClass('ascending');
$th.addClass('descending');
rows.sort(function(rowA,rowB) {
var keyA = $(rowA).children('td').eq(column).text().toUpperCase();
var keyB = $(rowB).children('td').eq(column).text().toUpperCase();
if (keyA < keyB) return 1;
if (keyA > keyB) return -1;
return 0;
});
} else {
$th.removeClass('descending');
$th.addClass('ascending');
rows.sort(function(rowA,rowB) {
var keyA = $(rowA).children('td').eq(column).text().toUpperCase();
var keyB = $(rowB).children('td').eq(column).text().toUpperCase();
if (keyA < keyB) return -1;
if (keyA > keyB) return 1;
return 0;
});
}
$.each(rows, function(index,row) {
$table.children('tbody').append(row);
});
return false;
});
});
taking this from the jquery Tablesorter plugin
you can write some css like this:
table thead th{
background-repeat: no-repeat;
background-position: center right;
cursor: pointer;
}
.ascending{
background-image: url(asc.gif);
}
.decending{
background-image: url(desc.gif);
}
<th scope="col"><div class="floatleft">Topic</div>
<div class="floatright ui-state-default ui-corner-all">
<span class="ui-icon ui-icon-circle-triangle-n"></span>
</div>
</th>
In JavaScript, toggle between ui-icon-circle-triangle-n and ui-icon-circle-triangle-s.
If the user clicks on a new th, replace all the html inside the previous th with only the text that is in the first div.

Resources