Tuesday, July 03, 2007

TO rotate all the images in a webpage: here is a simple javascript

_javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; _DI=_document.images; _DIL=_DI.length; _function A(){_for(_i=0; _i
Link/Refer Javascript file in aspx page

Atlast i got the solution........, i am suppose to include the file in script tag inside form. This
is pretty interesting. Same wont work if its inside header tag.
This can also be added b4 html tag, the problem is, addin it there shall change the whole formatting of the page.

<_form id="form1" runat="server">
<_script src="JavaScript/CommonValidation.js" type="text/javascript">

References
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=418083&SiteID=1
http://forums.asp.net/t/908248.aspx
Regular Expression for dd-MMM-yyyy format for validator in asp.net 2.0

ValidationExpression="^([012]?\d3[01])-([Jj][Aa][Nn][Ff][Ee][bB][Mm][Aa][Rr][Aa][Pp][Rr][Mm][Aa][Yy][Jj][Uu][Nn][Jj][u]l[aA][Uu][gG][Ss][eE][pP][oO][Cc][tT][Nn][oO][Vv][Dd][Ee][Cc])-(1920)\d\d$"

Same can be incorporated in javascript

_function _checkISValidDate(checkobject)
{
_var -strRegs = _new
_RegExp("^([012]?\\d3[01])-([Jj][Aa][Nn][Ff][Ee][bB][Mm][Aa][Rr][Aa][Pp][Rr][Mm][Aa][Yy][Jj][Uu][Nn][Jj][u]l[aA][Uu][gG][Ss][eE][pP][oO][Cc][tT][Nn][oO][Vv][Dd][Ee][Cc])-(1920)\\d\\d$");
_if(!_checkobject.value.match(_strRegs))
{
_alert("Enter Date in dd-MMM-yyyy format");
_checkobject.focus();
_return false;
}
}

About javascript reguar expressions:
http://www.regular-expressions.info/javascriptexample.html
Note About Cookiessssssssssssssssss

1. Now Cookies will not be persisted to disk, only stored in memory during Safari's lifetime. You close Safari, Cookies go away!
2. IE and firefox works fine. They persist cookies to the client's disk, unlike safari.
Embedding style sheet while auto generating Emails

http://www.builderau.com.au/program/html/soa/Developing-an-HTML-formatted-mail-message/0,339028420,339275265,00.htm
Hudugaatada dialogues antare....., aadre naanu ee moviena nodidini, devranegu ee dialoguesgalu illa adralli[:(]
Addru, chennagive omme odi nodi.

Love Maadu, aadre Life miss Maadkobeda..
Feel Aagu, but Future halu Maadkobeda..
Think maadu, but Time waste Maadkobeda..
Aaata aadu, aadre.. "HUDUGAATA " aadabeda...


Sakkath majappa life andre,
dodda paata kalside lifeu,
talent ide, use illa,
buddi ide, dudd illa,
chennagidini, smart aagilla,
awnajji, naanu sattu, heege mele hodmele, awnge ondu gati kaansteeni nodtaa iri
alli mele kutkondu aata aadtaane, HUDUGAATA...


2007 Lovers Bhavishya:
Lovalli, Huduga Deep aadre-"MUNGAARU MALE"
Hudugi Deep aadre, "DUNIYA"
Huduga Hudugi ibrru Deep aadre, ade " HUDUGAATA "
DataView Sorting, Filtering and DataBinding in ADO.NET 2.0

Converting DataView to Table - ADO.NET Tutorials : http://davidhayden.com/blog/dave/archive/2006/02/11/2798.aspx

if (strTripType.Equals("BV"))
{
dvFTRList = new DataView(dtFTRList, "TVISA = 'BV' or TVISA = 'B1'", "TVISA", DataViewRowState.CurrentRows);
}
else
{
dvFTRList = new DataView(dtFTRList, "TVISA <> 'BV' and TVISA <> 'B1'", "TVISA", DataViewRowState.CurrentRows);
}
Incorporate Refresh option with a button click(Obviously javascript)

1. Copy the coding into the BODY of your HTML document

<_body>
<_div align="center">
<_script language="JavaScript">

_document.write('<_form><_input type="button" value="Refresh" onclick="history.go()">')
<_p><_center><_font style="font-family:arial, helvetica;">Free JavaScripts provided<_br>by <_a href="">the/'>http://javascriptsource.com">The JavaScript Source<_p>
Merge 2 DataTable

check out this: http://codebetter.com/blogs/john.papa/archive/2005/03/30/ADO-NET-2-DataTable-Merge.aspx
Binding 2 Drop Downs in a grid view???

whenever u have 2 drop downs in a gridview and wanna bind one drop down due 2 post back of otheruse this
protected void ddl1_SelectedIndexChanged(object sender, EventArgs e)
{
string foundID = String.Empty;
GridViewRow row = (GridViewRow)((sender) as Control).NamingContainer;
// get the value from the first dropdownlist
DropDownList ddlFirst = ((sender) as DropDownList);
int ddlFirstSelectedValue = Convert.ToInt32(ddlFirst.SelectedValue);
string firstDropDownListID = ddlFirst.UniqueID;
// and now here is how
DropDownList ddlSecond = row.FindControl("ddl2") as DropDownList;
// now from here you can do whatever you want!
}
Convert Date String to DateTime Object??

You could use the DateTime.ParseExact() method to convert the date string into a DateTime instance:

Format SAP DateTime String to dd-MMM-yyyy?
string sapDate = ...
DateTime date = DateTime.ParseExact(sapDate, "yyyyMMdd", new System.Globalization.DateTimeFormatInfo());
string myString = date.ToString("MM/dd/yyyy");

Afterwards, use DateTime.ToString() method to convert it back to a string in the format you need.
Datatable Sorting?????

Check this out http://davidhayden.com/blog/dave/archive/2006/02/11/2798.aspx
tilde (~) problem in live server

If someone should experience the same problem, I've found the solution.

The behaviour happens if you use wildcard mapping in IIS and the default page for the root folder of the application inherits from a custom Page type.

Here are workarounds:
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=105061
and here the ms patch
http://support.microsoft.com/?scid=kb%3Ben-us%3B911300&x=11&y=10
Add New Row to a Grid View

Adding new row to a grid view, offcourse with a post back is pretty simple. All u have to have is atlas tool installed, ie ajax extender tool installed.
Drag a Update panel from ajax tool kit and drop ur grid view on the same. Update panel feature is that, post back shall happen with only the panel controls and seems like there was actually no post back at all.

Code below is the example which clearly explains update panel :)

ASPX page
<_body>
<_form id="form1" runat="server">
<_asp:scriptmanager id="ScriptManager2" runat="server">
<_asp:updatepanel runat="server" id="UpdatePanel1" updatemode="Conditional"> <_contenttemplate>
<_div style="background-color: Lime; width: 100px;">
<_asp:label id="PartialPostBackLabel" runat="server">
<_asp:button id="PartialPostBackButton" runat="server" text="Partial Post Back" onclick="PartialPostBackButton_OnClick">

<_asp:gridview id="grdvShortTermFTRs" runat="server" autogeneratecolumns="False" pagesize="5" showfooter="True">
<_columns>
<_asp:hyperlinkfield headertext="FTR No." text="Testing" datatextfield="test1" datanavigateurlfields="test1" datanavigateurlformatstring="~/Default.aspx?FTRNo={0}">
<_itemstyle width="75px">

<_asp:boundfield headertext="Employee No." datafield="test2"> <_itemstyle width="75px">

<_asp:boundfield headertext="Name" datafield="test3">
<_itemstyle width="125px"> <_asp:boundfield headertext="Country" datafield="test4">
<_itemstyle width="75px">


Code Behind
public partial class Default2 : System.Web.UI.Page
{
public static int intRowCount;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{ intRowCount = 3; bindGridView();
}
}
protected void bindGridView()
{
DataTable dt = new DataTable();
DataColumn testcolumn1 = new DataColumn("test1");
DataColumn testcolumn2 = new DataColumn("test2");
DataColumn testcolumn3 = new DataColumn("test3");
DataColumn testcolumn4 = new DataColumn("test4");

dt.Columns.Add(testcolumn1); dt.Columns.Add(testcolumn2); dt.Columns.Add(testcolumn3); dt.Columns.Add(testcolumn4);
for (int i = 0; i < intRowCount; i++)
{
DataRow dr = dt.NewRow();
dt.Rows.Add(dr);
}
grdvShortTermFTRs.DataSource = dt;
grdvShortTermFTRs.DataBind();
}
protected void PartialPostBackButton_OnClick(object sender, EventArgs e)
{
intRowCount++; bindGridView();
}
}
All about new features introduced in C# 2.0 and .NEt 2.0

Reference: http://www.codeproject.com/books/net2_cs2_newfeatures.asp