EnableFeature.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace MyWebRepo
{
public partial class EnableFeature : System.Web.UI.Page
{
public bool feature_enable = false;
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
EnableFeature.aspx
body
form
<%-- Traditional Logic : We, used to check the settings in CodeBehind file and then set btnAbc.Visible=false :(
Why do we take extra-burdon to load and hide it; What happen if we do not create the button at all. So we turns to "New Logic"
--%>
<%-- New Logic :Use if in the webpage to check if the feature enabled/disabled. We may read the settings from DB also --%>
<% if (feature_enable)
{ %>
Button ID="btnAbc" runat="server" Text="My Button"
<% } %>
/form
/body
Thursday, May 26, 2011
JavaScript in C#
st += " if(" + sales_tot_qty.ToString() + "==" + selected_qty.ToString() + ")";
st += " {";
st += " $('#tabs').tabs('enable',1);";
st += " }";
st += " else";
st += " {";
st += " $('#tabs').tabs('disable',1);";
st += " }";
st += "});";
st += "";
Page.ClientScript.RegisterStartupScript(typeof(string), "tabswitch", st);
Hierarchy ID

create table #region
(
nodeID hierarchyid,
regionID int identity(1,1),
regionName varchar(100),
)
-- First row
insert into #region(nodeID,regionName) values(hierarchyid::GetRoot(),'India')
go
-- Second row
declare @rootID hierarchyid = (select hierarchyid::GetRoot() from #region)
insert into #region (nodeID,regionName) values(@rootID.GetDescendant(NULL,NULL),'Kerala')
--Third row
declare @firstChild hierarchyid = @rootID.GetDescendant(NULL,NULL)
insert into #region (nodeID,regionName) values(@rootID.GetDescendant(@firstChild,NULL),'Tamilnadu')
-- Kerala -> Palakkad
select @rootID = CAST('/1/' as hierarchyid)
insert into #region (nodeID,regionName) values(@rootID.GetDescendant(NULL,NULL),'Palakkad')
-- Kerala -> Trivandrum
select @firstChild = @rootID.GetDescendant(NULL,NULL)
insert into #region (nodeID,regionName) values(@rootID.GetDescendant(@firstChild,NULL),'Trivandrum')
-- Kerala -> Calicut
declare @secondChild hierarchyid
select @secondChild = @rootID.GetDescendant(@firstChild,NULL)
insert into #region (nodeID,regionName) values(@rootID.GetDescendant(@secondChild,NULL),'Calicut')
-- Kerala -> Kannur
declare @thirdChild hierarchyid
select @thirdChild = @rootID.GetDescendant(@secondChild,NULL)
insert into #region (nodeID,regionName) values(@rootID.GetDescendant(@thirdChild,NULL),'Kannur')
-- Kerala -> Palakkad -> Mannarkkad
select @rootID = CAST('/1/1/' as hierarchyid)
insert into #region (nodeID,regionName) values(@rootID.GetDescendant(NULL,NULL),'Mannarkkad')
select * from #region
select nodeID.ToString(), regionName from #region
drop table #region
Difference between float and decimal
float vs decimal
SET @Float1 = 54;
SET @Float2 = 3.1;
SET @Float3 = 0 + @Float1 + @Float2;
SELECT @Float3 - @Float1 - g@Float2 AS "Should be 0";

DECLARE @Float1 decimal(8,3), @Float2 decimal(8,3), @Float3 decimal(8,3), @Float4 decimal(8,3);
SET @Float1 = 54;
SET @Float2 = 3.1;
SET @Float3 = 0 + @Float1 + @Float2;
SELECT @Float3 - @Float1 - @Float2 AS "Should be 0";

Visual Studio Command Line Debugging
We may build VS Solution from the VS Command prompt as
msbuild F:\WorkingFolderRauf\Work\ClearCanvasSource\SourceCodeMirror\WebViewer\ImageViewer\ImageViewer.sln
msbuild F:\WorkingFolderRauf\Work\ClearCanvasSource\SourceCodeMirror\WebViewer\ImageViewer\ImageViewer.sln
Subscribe to:
Posts (Atom)