Tuesday, November 24, 2009

GridView with CSS

<asp:GridView ID="gvShowCourses" runat="server" AutoGenerateColumns="false" CssClass="Grid" AlternatingRowStyle-CssClass="AlternatingItem"></asp:GridView>
and in the css file add the following style :

.Grid{ border:none; color:#333333; width:100%; }
.Grid tr{ vertical-align:top;}
.Grid th {background-color:#990000;font-weight:bold;color:White;padding:5px;}
.Grid td {background-color:#eeeeee;font-weight:normal;color:#333333;padding:5px;}
.AlternatingItem td{background-color:#FFFFFF;font-weight:normal;color:#333333;padding:5px;}

Difference between textarea and all other controls

When disabling the controls on the form.. remember:

All the other controls like text and button and dropdrownlist, you set Enabled= false.

But with textarea, you set Disabled = true;

Do not know why that is different.

Clear dropdown index...

Finally found the solution to the following error :

Server Error in '/' Application.
Cannot have multiple items selected in a DropDownList.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Cannot have multiple items selected in a DropDownList.

Solution:
You just set the dropdownlist.SelectedIndex = -1;

Thats all folks !!!


Friday, August 28, 2009

using COALEASE in t-sql

So, you have text you want to select for all the rows of a table, almost similar to AVG function for numbers

Here is the solution I found, thanks Viper

DECLARE @AllNotes varchar(4000)

SELECT @AllNotes = COALESCE(@AllNotes + ', ', '') + (Notes + ' (added by ' + addedby + ')')
FROM   Ranking
WHERE  scholarshipID=52

PRINT @AllNotes

Monday, July 6, 2009

ASP.net 2.0 memberships issue

I was trying to install and run the memberships and roles DB from asp.net 2.0 and had the following error show up repeatedly

An error was encountered. Please return to the previous page and try again.

The following message may help in diagnosing the problem: An error occurred during the execution of the SQL file 'InstallCommon.sql'. The SQL error number is 5110 and the SqlException message is: The file "S:\APP_DATA\ASPNETDB_TMP.MDF" is on a network path that is not supported for database files. CREATE DATABASE failed. Some file names listed could not be created. Check related errors. Creating the ASPNETDB_1735c56c9fbe43928ee626f81923d937 database... at System.Web.Administration.WebAdminPage.CallWebAdminHelperMethod(Boolean isMembership, String methodName, Object[] parameters, Type[] paramTypes) at ASP.security_users_adduser_aspx.PopulateCheckboxes() in c:\Windows\Microsoft.NET\Framework\v2.0.50727\ASP.NETWebAdminFiles\Security\Users\addUser.aspx:line 28 at ASP.security_users_adduser_aspx.Page_Load() in c:\Windows\Microsoft.NET\Framework\v2.0.50727\ASP.NETWebAdminFiles\Security\Users\addUser.aspx:line 22 at System.Web.Util.CalliHelper.ArglessFunctionCaller(IntPtr fp, Object o) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

So, after hours of research and tonnes of googling, here is what resolved my issues

My web.config has following setup now


If you do this the SqlRoleProvider will be lost and cannot connect to the database. If you did this you have to supply a cutom role provider thru your web.config like this one,
< enabled="true" defaultprovider="CustomizedRoleProvider">
<>
< add name="CustomizedRoleProvider"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="AnotherLocalServer" / >
< /providers >
< /roleManager >







Friday, April 24, 2009

dekh lo Khvaab magar Khvaab kaa charchaa na karo

dekh lo Khvaab magar Khvaab kaa charchaa na karo
log jal jaayenge suuraj kii tamannaa na karo

vaqt kaa kyaa hai kisii pal bhii badal sakataa hai
ho sake tum se to tum mujh pe bharosaa na karo

kirchiyaan TuuTe hue aks kii chubh jaayengii
aur kuchh roz abhii aaiinaa dekhaa na karo

[aks = reflection]

ajnabii lagne lage Khud tumhen apnaa hii vajuud
apne din raat ko itnaa bhii akelaa na karo

Khvaab bachchon ke khilaunon kii tarah hote hain
Khvaab dekhaa na karo Khvaab dikhaayaa na karo

be-Khayaalii men kabhii uNgaliyaa.N jal jaayengii
raakh guzare hue lamhon kii kuredaa na karo

mom ke rishte hain garmii se pighal jaayenge
dhuup ke shahar men "Aazer ye tamaashaa na karo

Wednesday, January 14, 2009

इक इंतज़ार सा था अब नज़र में वो भी नहीं

इक इंतज़ार सा था अब नज़र में वो भी नहीं
सफर में मरने की फुर्सत थी घर में वो भी नहीं

ज़रा मलाल की ज़ुल्मत को टालने के लिए
कई ख़याल थे अब तो असर में वो भी नहीं

[malaal = sorrow/anguish; zulmat = darkness; asar = effect]

जो संग -ओ -खार थे मेरी ही गर्दिशों तक थे
मैं रह -गुज़र में नहीं रह -गुज़र में वो भी नहीं
[sang = stone; Khaar = thorn]

थे चश्म -ऐ -बाम नगर में अजब तुलू के रंग
वो इक निशात -ऐ -सहर था सहर में वो भी नहीं
[tuluu = dawn; nishaat-e-subah = happiness of dawn]

रहे न कुछ भी मगर ये कैफ क्या कम है
जिस आगही की कमी थी हुनर men वो भी नहीं
[kaif = intoxication; aagahii = forewarning; hunar = skill]