Showing posts with label Solved Issues. Show all posts
Showing posts with label Solved Issues. Show all posts

Monday, December 2, 2013

Float div position to top when you scroll

In the below code I have explained about Maintaining div tag at top of the screen when scrolling..

IF my current position is greater or equal to the “sticker” position, give the sticker div a class of “stick”.  This changes the CSS of the div to have a FIXED position as long as the viewport is lower than the position of the sticker.





HTML - Take a div tag which contain the data which you want to float.

<div id="sticker">
    ...start scrolling..
   //Add your Code block here...
</div>

CSS 
Styles applied to div#sticker and the class “.stick
"stick" class is most important, which maintain position when you scroll.

div#sticker {
    padding:20px;
    margin:20px 0;
    background:#AAA;
    width:190px;
}
.stick {
    position:fixed;
    top:0px;

}


jQuery – Calculates the position of the sticker div and makes its position fixed if the page has scrolled that far

$(document).ready(function() {
    var s = $("#sticker");
    var pos = s.position();                    
    $(window).scroll(function() {
        var windowpos = $(window).scrollTop();
        s.html("Distance from top:" + pos.top + "<br />Scroll position: " + windowpos);
        if (windowpos >= pos.top) {
            s.addClass("stick");
        } else {
            s.removeClass("stick"); 
        }

    });

Tuesday, September 24, 2013

Dynamically Enable or Disable Required Field Validator


To enable or disable the required field validator control based on any selection
Enable or Disable ASP.Net Validation on client side

//Syntax:
ValidatorEnable(ValidatorContronName,Boolean);

//Explanation:
ValidatorContronName - This is ClientID of the Validation control.
Boolean - true(Enable) / false(Disable)

//Example:
rfvOther: is a Required Field Validator
ValidatorEnable(document.getElementById('<%=rfvOther.ClientID%>'), false);


Explonation#2:
'ValidatorEnable' or 'ValidatorUpdateDisplay' will immediately validate the associated control and show any validation messages. If this is not wanted because you just want to toggle the enabled/disabled switch but wait until form submission to validate, then the 2nd method of calling enabled on the object is the preferred method. If you do want immediate validation, then this can be done in a single line of code passing in the ID of the RequiredFieldValidator as displayed below:
ValidatorEnable($get('<%=RequiredFieldValidator1.ClientID %>'), true);
However, if you want only to enable/disable the validator, use the code below and do not make any additional calls to the built in JS functions. The error from previous posts states to set the .enable property yet there is no such thing. You must set the .enabled property on the server control. The code below shows this:
var validator = $get('<%=RequiredFieldValidator1.ClientID %>');
validator.enabled = true;

Monday, July 22, 2013

Check if Function Exists Before Calling

When using scripts that are shared between different areas of a site, there may be cases where a function is called that doesn't exist. 
you can just check if the function exists before calling it to avoid the error:

Java Script :
if (typeof yourFunctionName == 'function') { yourFunctionName(); }else{ alert('Check yourFunctionName!'); }

Jquery:
Also could be:
$.isFunction(yourFunctionName)&&yourFunctionName()

or if you are sure that if its exists than its a function:
yourFunctionName&&yourFunctionName()

Tuesday, June 26, 2012

Error : Cannot open database requested by the login. The login failed. Login failed for user 'IIS APPPOOL\

Issue : Cannot open database  requested by the login. The login failed. Login failed for user 'IIS APPPOOL\.
This type of issues will get if u connecting to database using Windows Authentication mode you have to give permission individually if u install SQL server in Windows Authentication mode.

If u install  SQL server in window authentication by default If you do not choose mixed authentication at the time of SQL Server installation. However these modes can be changed even after installation of SQL Server.


How to Change Windows Authentication To Mixed Mode In SQL Server:
http://vijayraju-ourworld.blogspot.in/2012/06/change-windows-authentication-to-mixed.html

then restart ur Application if possible restart ur Machine then ur issue will clear

Monday, June 25, 2012

Error : How do I change the default developement environment in Visual Studio

Issue : If u selected VB or any other language as the default lDE, but now u want to change to C# or any other,
then proceed the following steps.


1. Choose Tools -> Import and Export Settings...
2. Select Reset All Settings and click Next
3. Select whether you would like to save the current settings and click Next
4. Select the settings you want to use and click Finish