Thursday, February 17, 2011

iPod models


1. ipod touch 1g available in 8/ 16/ 32 GB. model number is A1213 ( model number is written on back side of ipod)


2. ipod touch 2g available in 8/ 16/ 32 GB model number is A1288 ( model number is written on back side of ipod)
(ipod touch 2g has two models. they are mb model and mc model) ..mb model released earlier and mc model was released with ipod touch 3g. some shop sell them saying it as 3g. But actually it is actually 2g ipod touch)


3. ipod touch 3g available in 32/ 64 GB model number is A1318 ( model number is written on back side of ipod)


4. ipod touch 4g available in 8/ 32/ 64 GB. model no is A1367 ( model number is written on back side of ipod)
( only 4g ipod touch has the camera function)

you can easily identify ipod by checking model number which is written on every ipod touch back side


you can check these two links to know more

http://support.apple.com/kb/ht1353
http://en.wikipedia.org/wiki/IPod

Sorting / Paging on Asp.Net GridView without a DataSourceControl DataSource

If we set AllowPaging="true" or AllowSorting="true" on a GridView control without using a DataSourceControl DataSource (i.e. SqlDataSource, ObjectDataSource),
we will run into the following errors:

When changing the page on the GridView control:

"The GridView 'GridViewID' fired event PageIndexChanging which wasn't handled."

When clicking a column name to sort the column on the GridView control:

"The GridView 'GridViewID' fired event Sorting which wasn't handled."

As a result of not setting the DataSourceID property of the GridView to a DataSourceControl DataSource, we have to add event handlers for sorting and paging.


private string ConvertSortDirectionToSql(SortDirection sortDirection)
{
string newSortDirection = String.Empty;

switch (sortDirection)
{
case SortDirection.Ascending:
newSortDirection = "ASC";
break;

case SortDirection.Descending:
newSortDirection = "DESC";
break;
}

return newSortDirection;
}

protected void gridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gridView.PageIndex = e.NewPageIndex;
gridView.DataBind();
}

protected void gridView_Sorting(object sender, GridViewSortEventArgs e)
{
DataTable dataTable = gridView.DataSource as DataTable;

if (dataTable != null)
{
DataView dataView = new DataView(dataTable);
dataView.Sort = e.SortExpression + " " + ConvertSortDirectionToSql(e.SortDirection);

gridView.DataSource = dataView;
gridView.DataBind();
}
}

How to read the binding data record of the current row in Asp.Net GridView


You can get the binding data record using following code example:

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string name= DataBinder.Eval(e.Row.DataItem, "StudentName") as string;
if (name!= null && name.Length > 0)
{

}
}
}

Enable/Disable DIV tag and its inner controls using Javascript

JavaScript Code:

function toggleAlert() {
toggleDisabled(document.getElementById("content"));
}
function toggleDisabled(el) {
try {
el.disabled = el.disabled ? false : true;
}
catch(E){
}
if (el.childNodes && el.childNodes.length > 0) {
for (var x = 0; x < el.childNodes.length; x++) {
toggleDisabled(el.childNodes[x]);
}
}
}


Html Code:

<div id="content">
<table>
<tr>
<td><input type="text" name="foo" /></td>
</tr>
<tr>
<td>
<select name="bar">
<option>a</option>
<option>b</option>
<option>c</option>
</select>
</td>
</tr>
</table>
</div>
<input type="checkbox" value="toggleAlert()" onclick="toggleAlert()" />