Use the bellow code to display a Context Menu on right click..
Here a button is as context menu.
Javascript:
<script type="text/javascript">
function callme(x) {
var MainContent_btnX = document.getElementById("MainContent_btnX");
MainContent_btnX.style.display = 'block';
//alert(x);
}
</script>
ASP.Net
<asp:Button ID="btnX" runat="server" OnClick="btnX_Click" Text="Test Transaction" style="position:absolute;z-index:999;display:none" />
<asp:ListBox ID="lstBox" runat="server" oncontextmenu="callme('1');">
<asp:ListItem Text="Good">1</asp:ListItem>
<asp:ListItem Text="Morning"> 2</asp:ListItem>
</asp:ListBox>
Search This Blog
Saturday, June 9, 2012
Tuesday, June 5, 2012
how to set custom date format in javascript?
function parseDate(input, format)
{
format = format || 'dd/mm/yyyy'; // somedefault format
var parts = input.match(/(\d+)/g),
i = 0, fmt = {};
// extract date-part indexes from the format
format.replace(/(yyyy|dd|mm)/g, function(part) { fmt[part] = i++; });
return new Date(parts[fmt['yyyy']], parts[fmt['mm']]-1, parts[fmt['dd']]);
}
Usage
parseDate('01-31-2010', 'mm-dd-yyyy');
parseDate('31/01/2010', 'dd/mm/yyyy');
parseDate('2010/01/31');
{
format = format || 'dd/mm/yyyy'; // somedefault format
var parts = input.match(/(\d+)/g),
i = 0, fmt = {};
// extract date-part indexes from the format
format.replace(/(yyyy|dd|mm)/g, function(part) { fmt[part] = i++; });
return new Date(parts[fmt['yyyy']], parts[fmt['mm']]-1, parts[fmt['dd']]);
}
Usage
parseDate('01-31-2010', 'mm-dd-yyyy');
parseDate('31/01/2010', 'dd/mm/yyyy');
parseDate('2010/01/31');
Invalid object name "Tempdb.dbo.ASPStateTempApplications"
Execute the below script to solve the error : Invalid object name = 'tempdb.dbo.ASPStateTempApplications'.
USE [ASPState]
GO
DECLARE @return_value int
EXEC @return_value = [dbo].[CreateTempTables]
SELECT 'Return Value' = @return_value
GO
USE [ASPState]
GO
DECLARE @return_value int
EXEC @return_value = [dbo].[CreateTempTables]
SELECT 'Return Value' = @return_value
GO
Monday, June 4, 2012
how to populate cascading dropdownlist in javascript?
You can force it to populate by setting a different index.
<script type="text/javascript">
function pageLoad()
{
var cde = $find('test_cascade');
cde.set_contextKey("not raymond");
var parent = $get(cde.get_ParentControlID());
var index = parent.selectedIndex;
parent.selectedIndex = -1;
cde._onParentChange(null, false);
parent.selectedIndex = index;
cde._onParentChange(null, false);
}
</script>
<asp:DropDownList id= "ddl_state" runat="server" ></asp:DropdownList>
<asp:DropDownList id= "ddl_dist" runat="server" ></asp:DropdownList>
<ajaxToolkit:CascadingDropDown id="CascadingDropDown1" runat="server" ServicePath="WebService.asmx" ServiceMethod="GetAllDistrict" ParentControlID="ddl_state" TargetControlID="ddl_dist" Category="Districts" UseContextKey="true" LoadingText="Loading District" PromptText="Select a District" BehaviorID="test_cascade"> </ajaxToolkit:CascadingDropDown>
<script type="text/javascript">
function pageLoad()
{
var cde = $find('test_cascade');
cde.set_contextKey("not raymond");
var parent = $get(cde.get_ParentControlID());
var index = parent.selectedIndex;
parent.selectedIndex = -1;
cde._onParentChange(null, false);
parent.selectedIndex = index;
cde._onParentChange(null, false);
}
</script>
<asp:DropDownList id= "ddl_state" runat="server" ></asp:DropdownList>
<asp:DropDownList id= "ddl_dist" runat="server" ></asp:DropdownList>
<ajaxToolkit:CascadingDropDown id="CascadingDropDown1" runat="server" ServicePath="WebService.asmx" ServiceMethod="GetAllDistrict" ParentControlID="ddl_state" TargetControlID="ddl_dist" Category="Districts" UseContextKey="true" LoadingText="Loading District" PromptText="Select a District" BehaviorID="test_cascade"> </ajaxToolkit:CascadingDropDown>
Subscribe to:
Posts (Atom)