|
how to run event of asp contol by javascript code?
|
|
|
|
|
Quote: Hi,
Please try the following code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="textBoxUserId" runat="server"></asp:TextBox>
</div>
</form>
</body>
</html>
In the code behind :
protected void Page_Load(object sender, EventArgs e)
{
textBoxUserId.Attributes.Add("onkeyup", "hello();");
}
And put the script as:
<script type="text/javascript">
function hello() {
alert("do something somehting ")
}
</script>
Hope this helps.
Thanks,
Praneet
|
|
|
|
|
|
How to use modular script for different modules in website?(In General)
|
|
|
|
|
|
<div id="a">
<div id="b">
</div>
</div>
In this scenario, write a common function to handle the click function on the elements without propagating the event.
|
|
|
|
|
Please someone reply soon urgent requirement
|
|
|
|
|
<div id="a" onclick="onClick(event)">
<div id="b">
</div>
</div>
function onClick(event) {
event.stopPropagation();
}
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Thanks Peter
|
|
|
|
|
how I can use a variable passed by parameter in a javascript function in a lambda expression?
p.s: name of the variable = xyz
Code:
pendencias.push(@Model.Count(x => (x.FC_VH_OWNER_STATE_NM == "SP" && Convert.ToDateTime(x.FD_REQ_SERVICE_VALIDITY_DT) <= Convert.ToDateTime(System.DateTime.Now).AddDays(xyz))));
ERROR: Variable is not found
|
|
|
|
|
I am having a little issue, with getting dates to show up in desired (dd-mm-yyyy) format, however they are displayed as 'NaN Nan' on the line chart x-axis. I have added in a 'parseInt' date format but I am not sure if this is a correct approach.
Please advice. Many thanks for your help and time.
function drawVisualization(dataValues, chartTitle, columnNames, categoryCaption) {
if (dataValues.length < 1)
return;
var data = new google.visualization.DataTable();
data.addColumn('string', columnNames.split(',')[0]);
data.addColumn('number', columnNames.split(',')[1]);
data.addColumn('string', columnNames.split(',')[2]);
data.addColumn('datetime', columnNames.split(',')[3]);
for (var i = 0; i < dataValues.length; i++) {
var date = new Date(parseInt(dataValues[i].Date.substr(6), 10));
data.addRow([dataValues[i].ColumnName, dataValues[i].Value, dataValues[i].Type, date]);
}
var dateFormatter = new google.visualization.DateFormat({ pattern: 'dd MM yyyy' });
var line = new google.visualization.ChartWrapper({
'chartType': 'LineChart',
'containerId': 'PieChartContainer',
'options': {
'width': 950,
'height': 450,
'legend': 'right',
'hAxis': {
'format': "dd-MM-yyyy",
'hAxis.maxValue': 'viewWindow.max',
'maxValue': new Date(2014, 05, 30), 'minValue': new Date(2014, 04, 05),
'viewWindow': { 'max': new Date(2014, 05, 30) },
},
'title': chartTitle,
'chartArea': { 'left': 100, 'top': 100, 'right': 0, 'bottom': 100 },
'tooltip': { isHtml: true }
},
'view': {
'columns': [{
type: 'string',
label: data.getColumnLabel(3),
calc: function (dt, row) {
var date = new Date(parseInt(dt.getValue(row, 3)));
return dateFormatter.formatValue(date);
}
}, 1, {
type: 'string',
role: 'tooltip',
calc: function (dt, row) {
return 'Name: ' + dt.getValue(row, 0) + ', Decimal Price: ' + +dt.getValue(row, 1) + ', Date: ' + +dt.getFormattedValue(row, 3);
}
}]
}
});
new google.visualization.Dashboard(document.getElementById('PieChartExample')).bind([categoryPicker], [line]).draw(data);
}
|
|
|
|
|
miss786 wrote: however they are displayed as 'NaN Nan' on the line chart x-axis. The reason is the value is not a numeric.
miss786 wrote: I have added in a 'parseInt' date format but I am not sure if this is a correct
approach. I think you're getting NAN because you're getting an empty string or null & parsing directly. Just check the result of parseInt("") or parseInt(null)
So check the value before sending to Date function. Debug there.
|
|
|
|
|
Apology for the late response. Thank you very much for your feedback. I manage to get the date value pass the parseInt but however, now I am getting a blank screen on the client-end, with the following warning in the console debug of my chrome browser:
event.returnValue is deprecated. Please use the standard event.preventDefault() instead. --> warning
<script type="text/javascript">
function drawVisualization(dataValues, chartTitle, columnNames, categoryCaption) {
if (dataValues.length < 1)
return;
var data = new google.visualization.DataTable();
data.addColumn('string', columnNames.split(',')[0]);
data.addColumn('number', columnNames.split(',')[1]);
data.addColumn('string', columnNames.split(',')[2]);
data.addColumn('datetime', columnNames.split(',')[3]);
for (var i = 0; i < dataValues.length; i++) {
var date = new Date(parseInt(dt.getValue(row, 3)));
data.addRow([dataValues[i].ColumnName, dataValues[i].Value, dataValues[i].Type, date]);
}
var categoryPicker = new google.visualization.ControlWrapper({
'controlType': 'CategoryFilter',
'containerId': 'CategoryPickerContainer',
'options': {
'filterColumnLabel': columnNames.split(',')[2],
'filterColumnIndex': '2',
'ui': {
'labelStacking': 'horizontal',
'allowTyping': false,
'allowMultiple': false,
'caption': categoryCaption,
'label': 'Price Type',
}
}
});
var dateFormatter = new google.visualization.DateFormat({ pattern: 'dd MM yyyy' });
var line = new google.visualization.ChartWrapper({
'chartType': 'LineChart',
'containerId': 'PieChartContainer',
'options': {
'width': 950,
'height': 450,
'legend': 'right',
'hAxis': {
'format': "dd-MM-yyyy",
'hAxis.maxValue': 'viewWindow.max',
'maxValue': new Date(2014, 05, 30), 'minValue': new Date(2014, 04, 05),
'viewWindow': { 'max': new Date(2014, 05, 30) },
},
'title': chartTitle,
'chartArea': { 'left': 100, 'top': 100, 'right': 0, 'bottom': 100 },
'tooltip': { isHtml: true }
},
'view': {
'columns': [{
type: 'string',
label: data.getColumnLabel(3),
calc: function (dt, row) {
var date = new Date(parseInt(dt.getValue(row, 3)));
return dateFormatter.formatValue(date);
}
}, 1, {
type: 'string',
role: 'tooltip',
calc: function (dt, row) {
return 'Name: ' + dt.getValue(row, 0) + ', Decimal Price: ' + +dt.getValue(row, 1) + ', Date: ' + +dt.getFormattedValue(row, 3);
}
}]
}
});
new google.visualization.Dashboard(document.getElementById('PieChartExample')).bind([categoryPicker], [line]).draw(data);
}
Please advice, if possible. Many thanks.
|
|
|
|
|
miss786 wrote: event.returnValue is deprecated. Please use the standard event.preventDefault() instead. --> warning That's warning, possibly you're using new jQuery version. Try previous(your project's) version.
|
|
|
|
|
|
Hi,
How to disable JqueryDateTime Picker Image button .
But textbox i can disable ,I can't do Image button.
here code i am try it.
function disableDate() {
debugger;
document.getElementById('txtStartDate').disabled = true;
$get('txtStartDate').style.color = "gray";
$get('txtStartDate').disabled = true;
$('txtStartDate').datepicker('disable');
$('txtStartDate').datepicker('setDate', new Date()).datepicker('disable').blur();
$('txtStartDate').disableSelection = true;
}
<input id="txtStartDate" runat="server" class="TextBox DatePicker"
style="width: 125px" />
<style>
.ui-datepicker-trigger
{
position: relative;
top: 4px;
right: -3px;
height: 17px;
}
</style>
<script language="javascript" type="text/javascript">
var Dformat = "";
$(document).ready(function () {
var selectvalStartDate = $("#txtStartDate").val();
var sVal = document.getElementById('hdnPORTALID').value;
Dformat = GetDatePickerFormat(sVal);
$(".DatePicker").attr("placeholder", "Select date").datepicker({
showOn: "both",
buttonImage: "../images/datepicker_enable.png",
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: Dformat
});
});
</script>
thanks,
Karthikeyan,
|
|
|
|
|
Hi,
I am not sure whether this would work, but,
can you try this ?
<input name="date" id="datepicker" disabled="disabled" />
$('#datepicker').datepicker();
For further could you please check this link:-
https://forum.jquery.com/topic/disabled-datepicker[^]
Regards,
Praneet
|
|
|
|
|
$("txtStartDate").datepicker({
disabled:true
});
modified 9-May-14 14:36pm.
|
|
|
|
|
Can anyone provide me design or flow to create application for formula builder or expression builder using java-script. just like a calculator but little advanced. which can read any mathematical expression.
ex:
(a+b)/c
5*LOG(1000)* -2/3
MAX(4, 6%7)
(-2*(4*5)+4)/2 -6
|
|
|
|
|
|
You can use Javascript method eval().
It can evaluate functions and expressions as a string.
Life is a computer program and everyone is the programmer of his own life.
|
|
|
|
|
Hi ,
I have an html page for showing google maps. It is showing fine in chrome and firefox, but not in IE. How to fix this ?
Here is the page I used
<title>Google Maps Multiple Markers
var locations = [
['Bondi Beach', -33.890542, 151.274856, 4],
['Coogee Beach', -33.923036, 151.259052, 5],
['Cronulla Beach', -34.028249, 151.157507, 3],
['Manly Beach', -33.80010128657071, 151.28747820854187, 2],
['Maroubra Beach', -33.950198, 151.259302, 1]
];
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 10,
center: new google.maps.LatLng(-33.92, 151.25),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var infowindow = new google.maps.InfoWindow();
var marker, i;
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: map
});
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
}
|
|
|
|
|
|
please embed your code with < pre > tags. (the code button in the toolbar when editing/writing a post)
like this...
Code here. You can choose between different language settings HTML / XML / ASP and javascript is what you should use here in your case ...
hope this helps.
|
|
|
|
|
I'm having an issue with the legend options of JQPlot.
I can do some things with the legend like defining the labels (array legendlabels), showSwatches and placement and location.
But any attempt in changing the background, textColor or fontSize, ... doesn't work. The plot shows, the legend shows, but none of these options work. I've been up and down the provided samples and they work. I compared them with my prototype here (also all the css and js includes), but still no dice.
The code doesn't seem wrong as the plot (and legend) show, but some of the options don't seem to do anything.
legend: {
show: true,
labels:legendlabels,
location:"n",
rendererOptions: {
placement:"outsideGrid",
textColor: "rgb (255, 100, 100)",
fontSize: "18pt"
}
},
has anyone encountered this issue? How can I solve this?
(google's results didn't yield solutions for me either)
thanks!
[SOLUTION]
You need to add the correct javascript file at the bottom of the page:
<script class="include" type="text/javascript" src="./Scripts/JQPlot/plugins/jqplot.enhancedLegendRenderer.js"></script>
and use the
renderer:$.jqplot.EnhancedLegendRenderer,
option in the json definition.
then you place any css styling properties in the
rendererOptions: {}
object.
[/SOLUTION]
modified 23-Apr-14 9:27am.
|
|
|
|
|