Welcome to ViSh’s Blogs

February 5, 2010

DevExpress ASPxGridView with Microsoft Ajax Control Toolkit

Filed under: ASP.NET — infovish @ 9:35 am

I was wondering why my devexpress aspxgridview was not working inside ajax control toolkit. I was able to bind data but could not do sorting and paging. Then with the help of Firefox I came to know that scripts seems to be not registered and hence I registered it manually by below way:

DevExpress.Web.ASPxGridView.ASPxGridView.RegisterBaseScript(this.Page);

January 4, 2010

Aal Izz Well – 3 idiots

Filed under: Movies — infovish @ 2:08 pm

A must must see movie after long long time. This movie is especially for those who are into studies and are just doing study. One has to be well educated instead of well trained. This is the lesson which I got from the movie.

 

200px-Threeidiots2

Read more @ http://en.wikipedia.org/wiki/3_Idiots

October 14, 2009

Detect ‘Enter’ key and press desired button – for all browsers

Filed under: Uncategorized — infovish @ 1:14 pm

We all need to set a default button on an asp.net page. There are few options too but with some limitations. As for e.g. we have an option to call click method of javascript and another option is set DefaultButton property of an asp.net panel but both would not work in firefox. To run default button or call any button on enter key will work as below:

<asp:TextBox ID=”txtUserLogon” runat=”server” Style=”display: none” ValidationGroup=”SearchUser”
onkeypress=”searchKeyPress(event);”></asp:TextBox>

function searchKeyPress(e)
{
if (window.event) { e = window.event; }
if (e.keyCode == 13) {
var b = document.getElementById(‘<%= lnkSearch.ClientID %>’);
if (b && typeof (b.click) == ‘undefined’) {
b.click = function() {
var result = true;
if (b.onclick) result = b.onclick();
if (typeof (result) == ‘undefined’ || result) {
eval(b.getAttribute(‘href’));
}
}
}
}
}

Help from: http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/

March 21, 2009

Add Tooltip to ListBox Control in ASP.NET

Filed under: Uncategorized — Tags: — infovish @ 8:08 am

I was trying add a title or horizontal scroll bar to one of my asp.net listbox control. This is required because few of my list item text was lengthy. Finally I got solution.

foreach (ListItem item in lstSourceList.Items)
{
item.Attributes.Add(“title”, item.Text);
}

February 1, 2008

Detect Enter key and click on button in Javascript

Filed under: Javascript — infovish @ 7:59 am

function DetectNEnter(e, btn)
{
var characterCode;
if(e && e.which) // NN4 specific code
{
    e = e;
    characterCode = e.which;
}
else
{
    e =
event
   
characterCode = e.keyCode; // IE specific code
}
if (characterCode == 13) //// Enter key is 13
{
    e.returnValue=
false;
    e.cancelBubble =
true;
    document.getElementById(btn).click();
}
    else return false;}

txtOrd.Attributes.Add(“onKeyPress”, DetectNEnter(event, ‘” + btnGo.ClientID + “‘)”);

January 10, 2008

Alternate to InnerText in Javascript

Filed under: Javascript — infovish @ 6:59 am

We all have used control.innertext property in javascript, but we all know the problem of browsers. Today I came to know that “innertext” property is not working in firefox/safari. what now ? Use “textContent” in lieu of “innertext” property. However “innerHtml” property is working fine with all browsers. COOL :)

E.g. :

var completeText = document.getElementById(‘divText’).textContent; // same as innertext.

January 8, 2008

Deferred Query and Non-deferred query

Filed under: Linq — infovish @ 8:46 am

A query is called to be deferred when it is performed during enumeration of the object and Non-deferred query is performed at the time when the query is called.

Example :

Lets say we have an array of integer:
int[] intArray = new int[] { 1,2,3,4,5 };

and we fire  a Linq query on that:
IEnumerable<int> ints = intArray.Select(i => i>2);

//Non-deferred query will be performed here.
// List<int> ints = intArray .Select(i => i>2).ToList();

//Print

//Deferred query will be performed here.
foreach (int item in ints)
{
   Console.WriteLine(” – ” + item + ” – “);
}

 

If by chance I change the value of 0th index of intArray, it will be reflected without again firing Linq query.

Deferred Query,  will be performed during enumeration (when calling foreach) and not when query is executed and  reverse in the case of non-deferred i.e. it will be performed when query gets executed.

January 5, 2008

Safari : Pop Up Problem.

Filed under: General — infovish @ 8:40 am

Once upon a time,  ha ha ha. Hold it. Today itself I was working with pop up window and it was not working in Safari. Why ? Even I wondered. Everything seems to be fine, except except URL.Safari needs a http request to process a page and may be to process some JS :)

So after entering a complete URL, like http://localhost/saftest/index.htm, my pop up started running successfully.

January 3, 2008

Linq and its Components

Filed under: Linq — infovish @ 7:06 am

LINQ is all about queries, whether they are queries returning a set of matching objects, a single object, or a subset of fields from an object or set of objects. In LINQ, this returned set of objects is called a sequence.

LINQ to Objects :
LINQ to Objects is the name given to the IEnumerable<T> API for the Standard Query Operators. It is LINQ to Objects that allows you to perform queries against arrays and in-memory data collections.

LINQ to XML :
LINQ to XML is the name given to the LINQ API dedicated to working with XML. This interface was previously known as XLinq in older prerelease of LINQ.

LINQ to DataSet :
LINQ to DataSet is the name given to the LINQ API for DataSets. Many developers have a lot of existing code relying on DataSets.

LINQ to SQL :
LINQ to SQL is the name given to the IQueryable<T> API that allows LINQ queries to work with Microsoft’s SQL Server database. This interface was previously known as DLinq in older prerelease of LINQ.

LINQ to Entities :
LINQ to Entities is an alternative LINQ API that is used to interface with a database. It decouples the entity object model from the physical database by injecting a logical mapping between the two.

Widening conversion and Narrowing conversion

Filed under: C# — infovish @ 5:18 am

Both Visual Basic and C# allow implicit conversion if the destination type can accommodate all possible values from the source type. That is called a widening conversion.

E.g. :

// C#
int intValue = 10;
double dblValue = 10.1001;
dblValue = intValue; // Conversion allowed.

If the range or precision of the source type exceeds that of the destination type, the operation is called a narrowing conversion, which usually requires explicit conversion.

Source : 70-536

Older Posts »

Blog at WordPress.com.