Monday, April 30, 2012

A network-related or instance-specific error

In previous articles i have explained  login failed for user 'sa' in sql server,.This is the common error will occur while establishing a connection to sqlserver. To resolve this problem we need to change network configuration  settings.Here i will explain how to change remote connection settings in configuration area .First we need to check the given data source name is correct or not in connection string.The TCP/IP protocol should be enable to made such type connection.The following steps will describe how to enable TCP/IP protocol in sql server configuration manager
Go To-->Configuration Tools folder which is in MS Sql Server 2008 folder in start menu
2.Select server Network configuration-->click on protocols for SQLEXPRESS.
Then we can see the protocols at Right side panel.By default the TCP/IP status is in disable mode.So we need to change status to enable


Sunday, April 29, 2012

How the item is active based on position in xml using xslt

Here i will show how to create position  based div's from XML data source using xslt.The XML data source has parent attribute with three items .There is on click function to make the selected div as active .By default we will set the first items as active link

<?xml version="1.0" encoding="utf-8" ?> 
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:template match="/">
<div>
- <ul>
- <xsl:for-each select="Menu/Item">
- <xsl:if test="ItemType != 'Javascript'">
- <li>
- <xsl:if test="position() = 1">
- <xsl:attribute name="class">
  <xsl:text>active</xsl:text>
  </xsl:attribute>
  </xsl:if>
- <a title="" onclick="return false;">
- <xsl:attribute name="href">
- <xsl:choose>
- <xsl:when test="position() = 1">
  <xsl:text>#stories</xsl:text>
  </xsl:when>
- <xsl:when test="position() = 2">
  <xsl:text>#events</xsl:text>
  </xsl:when>
- <xsl:when test="position() = 3">
  <xsl:text>#news</xsl:text>
  </xsl:when>
  </xsl:choose>
  </xsl:attribute>
  <xsl:value-of select="ItemTitle" />
  </a>
  </li>
  </xsl:if>
  </xsl:for-each>
  </ul>
</div>
  </xsl:template>
  </xsl:stylesheet>

Saturday, April 28, 2012

Postback forms in asp.net

It is a concept of html forms only when a form itself in its submission then we call this form/page as post back form/page. The basic question will be arise when we going thorough the postback concepts.How asp.net is related to this post back forms? If we create asp.net form we don't provide any action attribute to it. manually also it is not recommended to write action methods.
                               During rendering asp.net automatically writes action attribute which will call the some form or page name every asp.net form is a post back form. One more thing we have to know i:e why asp.net forces this post back concept.One of the main reason is to provide state management for page and its controls

 Note:- In asp.net 1.0/1.1 they was the only concept for post backs i:e straight post backs.Form asp.net 2.0 we can Even perform cross page post backs.Default is straight post back only

Friday, April 27, 2012

pass variable from codebehind to aspx (client side) in asp.net || pass value from server side to client side in Asp.net

In previous post i have given how to pass the variable value from client side  to server side (code behind).Now i will show how to pass the variable from code behind to aspx .Here i would not use any javascript or etc.Because there is so many ways to get the values to javascript variables from code behind.This process easy to understand for developers and who has not much knowledge in javascript.
<form  method="post" action="Calculation.aspx">
    <input id="h1" type="hidden" name="cart"  value="<%=strEncoded %>"/>
    <input id="h2" type="hidden" name="signature" value="<%=sign %>"/>
    <input type="button" name="submit"/>
</form>
When ever we assign the values to html control ,Those should be declare as "public" variable.Here the strEncoded,sign are passed to client side using "<%= >"
 public String strEncoded;
 public string sign;
//page_load
 strEncoded = "Encode string";
 sign= "teststring";

Thursday, April 26, 2012

Get the List of calendar events in ektron cms

The ektron calendar provides an easy ways to site admin to add,edit and update the events for calendar year or more.Here i will show how to get the calendar events list to list view.Using Web calendar API ,i will send the calendar id ,start date and end date as input parameters to get the list items between data range.Here the method Getlist() which will give the list of calendar events
 Ektron.Cms.Controls.Calendar c = new Ektron.Cms.Controls.Calendar();
 WebEventManager wManager = new WebEventManager();
 //calendar id in Workarea
 long calId = 1654;
 String st = DateTime.Now.ToString();//cuurent date
 String et = "31-04-2012 17:30:00";
 DateTime startdate= DateTime.Parse(st);
 DateTime enddate = DateTime.Parse(et);
 List webeventcalendarList = wManager.GetList(calId,startdate,enddate);
 if (webeventcalendarList != null)
{
list_events.DataSource = webeventcalendarList;
list_events.DataBind();
}
 else
{
Response.Write("There is no list of events");
}

Bel