Thursday, March 13, 2008
Empowerment
Here are the thoughts I shared with the group and a few points I wanted to write on...
Empowerment @ Wiki means increasing the strength of individuals & communities. I remember the leadership conference I attended @ Disney and some of the things Disney do to empower their employees. Disney does have processes & policies in place like any other organization does but what is more important is awareness of the process w.r.t the need, approach, expectations & decisions that the employ can take based on the situation.
Let me share an experience I learnt... on a sunny day afternoon a kid while walking in the Disney world accidentally dropped her ice-cream and there was a cast member (Disney employee) who quickly rushed to help clean her dress and buy a new ice-cream - WOW is the experience the kid would have received but analyzing what made it possible would be a process that mentioned x is the budget the employee can use to recover a situation with a clear definition of the boundaries. The first thought at this time would be pull our execs together to get some budget to empower people :)
Well that is definitely 1 way to look at it, now let me cite another experience I learnt… On day 1 the kid of the family bought a Mickey toy and then everyday when she returned home after the site-seeing she found Mickey doing some magic in the room like sometimes hiding below the pillow, reading her comic, etc and the kid was thrilled with the games Mickey played with her and she always came back to the hotel with the same energy levels she left every day morning for the rides… WOW is the experience the kid would have received but again analyzing what made is possible would just be the right attitude of the house-keeping cast member and effectively utilizing her creativity skills J
In both the examples employee realized power to do what is right for the customer as long as it is within the boundary of comforts of the guest, not impacting the interest of organization, employees & investors.
To summarize what I learnt was an employee can be empowered if he/she does the following:
· Awareness to information, choices & resources
· Situational decision making in the interest of the organization, employees & stake holders
· Encouraging positive thinking in the team & practicing strengths
And what one should not limit to self-imposed restriction viz.: Budget, roles, labor, etc.
Saturday, June 16, 2007
Delegation
DELEGATION is NOT (a)
1. An excuse to pass on work on us/excuse to pass on failure....
2. Planned approach to ensure I do not meet expectations and be at mercy....
3. Delegation or Containment in .NET :)
It is (b)
A tool for motivating and training an employee to realize their full potential...
(a) is an outcome of poor delegation and could also result in poor performance, job dissatisfaction, frustration, confusion, work overload & stress.
(b) is an outcome of effective delegation and could also result in better productivity, people development, job satisfaction and groom successor.
Delegation is the most commonly used and important skills with maximum impact on people development. Effectiveness of this skill is directly proportional to the manager being a leader. Hence it is worth investing in practicing and improving this skill.
Effective delegation is not about mentoring to get the job done but coaching the delegate to explore creativity, decision making and change management ability. In other words trust the delegatee with the task to take decisions and to react to the outcomes without seeking your direction. During the process take accountability of things going wrong and give recognition.
To ensure a task is delegated effectively use the same rules that you apply for commitments i.e. Specific, Measureable, Achievable, Realistic, Time bound.
Example: If you ask an employee to review timesheet every day and ask peers to update the entries the employee will just do that and will never understand/educate the importance of timesheet management and the impact of poor timesheet management. Instead if you ask the employee to ensure ethical timesheet management, you will get to hear decisions, opportunity to ask questions, understand pains of an employee, validate action plan and set expectations.
Friday, June 15, 2007
Windows Mobile - Application Remote Control
NOTE: This sample is provided "AS IS". It is a demonstration, provided for informational purposes only, and has not been rigorously tested with all environments and all scenarios.
Download source code here.
Add value to your email - Updated
Option Explicit
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As
Boolean)
'Author : Amith Ellur'Date : 20 May 2003
'Idea Conceived : Dr. Nitin Paranjape
On Error GoTo Hell
'holds the reference to ValueAdd subfolder in my personal folders
Dim mValueAddFolder As MAPIFolder
'holds the reference to a randomly selected folder with in "Of the day"
Dim mRandomFolder As MAPIFolder
'holds the reference to a randomly selected message from the randomly
selected folder
Dim mRandomMessage As PostItem
'the case sensitive folder structure expected is "Personal Folder->ValueAdd->Of
the day".
'With in the "Of the day" folder you can create multiple folder to
categorize the content
'I have Definition,Info, Murphy's Computer Law, Thought, Tip
'So the header of the content becomes randomly selected folder name
concatenated with " of the day" example "Murphy's Computer Law of the
day"
Set mValueAddFolder =
Application.Session.Folders("Current").Folders("ValueAdd").Folders("of
the day")
'this is the escape sequence for Subject EOM messages
'if the body contains "<AETip Of The Day>" i replace it with content
If InStr(Item.Body, "<AETip>") <> 0 Then
'Mail format has to be HTML please set this on Tools->Options->Mail
Format->Compose in this message format.
'this check ensures i don't add the content while i reply the mail for
the second time
If InStr(Item.HTMLBody, "of the day") = 0 Then
'processing needs to be done only if i have any subfolders in my "Of the
day" folder
If mValueAddFolder.Folders.Count >= 1 Then
Set mRandomFolder =
mValueAddFolder.Folders(Int((mValueAddFolder.Folders.Count * Rnd) + 1))
If mRandomFolder.Items.Count >= 1 Then
Set mRandomMessage = mRandomFolder.Items(Int((mRandomFolder.Items.Count
* Rnd) + 1))
'just adding some format so that the content has a header and sending
using HTML format
If Trim(mRandomMessage.HTMLBody) = "" Then
'Item.HTMLBody = Item.HTMLBody + "<P><B><FONT SIZE=2 FACE=Verdana>" +
mRandomFolder.Name + " of the day...</FONT></B></P>" +
mRandomMessage.Body
Item.HTMLBody = Replace(Item.HTMLBody, "<AETip>",
mRandomFolder.Name + " of the day: " + mRandomMessage.Body)
Else
'Item.HTMLBody = Item.HTMLBody + "<P><B><FONT SIZE=2 FACE=Verdana>" +
mRandomFolder.Name + " of the day...</FONT></B></P>" +
mRandomMessage.HTMLBody
Item.HTMLBody = Replace(Item.HTMLBody, "<AETip>",
mRandomFolder.Name + " of the day: " + mRandomMessage.Body)
End If
End If
End If
End If
Else
End If
Hell:
End Sub
Friday, January 05, 2007
The next phase of evolution
Today when I look back at the posts I have on the blog I realize my personal development has been extremely swift with no/minimal time to consolidate and hence no posts on my learnings.
In these 3 years a lot has changed on my professional front, I am associated with the software support function and manage the support business for a range of products.
At this time I am planning to spend my next few months writing about art and science of a few people management skills around essential Delegation, Coaching skills, support model, cost model, resource model, etc.
For those who read my blog for technical stuff, I will not disappoint them either and will soon release the code I recently developed to remotely control an application using windows mobile device & .net compact framework.
Please do not hesitate to use the comments section to suggest topics and I will try to put together something from my experience.
Sunday, October 17, 2004
AS/400 iseries in ASP.NET
Connecting to AS/400 from ASP.NET, following are the options available:
1. rfrompcb.exe
Fails with no error message but the following output:
IBM iSeries Access for WindowsVersion 5 Release 2 Level 0Transfer data to iSeries(C) Copyright IBM Corporation and Others 1984, 2002. All rights reserved.U.S. Government Users Restricted Rights - Use, duplication or disclosurerestricted by GSA ADP Schedule Contract with IBM Corp.Licensed Materials - Property of IBM
2. Program Files/IBM/Client Access/Shared/cwbx.dll - IBM AS/400 Client Acess Express ActiveX Object Library
Fails with [COMException] 'Unspecified Error' exception
Conclusion
The conclusion after a detailed study was the connectivity failed from ASP.NET but worked with from commandline or desktop application.
Problem
The problem is the identity under which aspnet worker process works is as configured in machine.config meaning 'machine' or SYSTEM or any NT user as specified and this user doesn't have rights to access AS/400 through the firewall.
Solution
The solution to this problem is to set the username and password values of
<ProcessModel>
Example:
- Open Browser and type a URL; you are able to visit the site but when you try to do the same in ASP.NET using webrequest.create method, it fails with an error The underlying connection was closed: Unable to connect to the remote server.
- Run a batch file that utilizes network resources; the batch file executes successfully but when you try to do the same in ASP.NET using process.start method, it fails without any error
The reason is ASP.NET by default runs under the context of ASPNET user, change the <processmodel> tag and specify a user who is authorized to access the web server as well as network/domain resources and your code will work.
Tuesday, September 14, 2004
SQL Server Custom Paging
SELECT *
FROM (SELECT TOP {0} *
FROM (SELECT TOP {1} *
FROM {2}
ORDER BY {3}) AS t1
ORDER BY {3} DESC) AS t2
ORDER BY {3}
Replace:
{0} with the page size (the number of records displayed on each page),
{1} with the page size * page number (1-based),
{2} with the name of the table you wish to query, and
{3} with a field name.
The following example retrieves rows 41-50 from the "Products" table of the Northwind database:
SELECT *
FROM (SELECT TOP 10 *
FROM (SELECT TOP 50 *
FROM Products
ORDER BY ProductID) AS t1
ORDER BY ProductID DESC) AS t2
ORDER BY ProductID
You can combine this query technique with custom paging to make DataGrid paging more efficient. With default paging, you must initialize the data source with all records displayed on all pages. With custom paging, you can initialize the data source with just those records that pertain to the current page.
Friday, August 20, 2004
Undocumented SQL SP's
Here is one such stored procedure, which is undocumented but is very useful for developers:
sp_MSforeachtable (T-SQL)
Syntax
sp_MSforeachtable[@command1 =] 'sql_command'
[, [@replacechar =] 'replacement_character']
[, [@command2 =] 'sql_command']
[, [@command3 =] 'sql_command']
[, [@whereand =] 'sql_command']
[, [@precommand =] 'sql_command']
[, [@postcommand =] 'sql_command']
Arguments
[@command1 =] 'sql_command'
Is the sql command to apply to each user table with the replacement_character where the table name would normally be placed. 'sql_command' is nvarchar(2000)*, varchar(255)+ with no default.
[, [@replacechar =] 'replacement_character']
Is the wild card character that will be replaced with each user table name. replacement_character is char(1) with a default of '?'
[, [@command2 =] 'sql_command']
Is the continuation of the sql command entered in @command1 to apply to each user table with the replacement_character where the table name would normally be placed. sql_command is nvarchar(2000)*, varchar(255)+ with a default of NULL. (Note: This parameter is not as useful on 7.0 since there are 4000 characters available in @command1)
[, [@command3 =] 'sql_command']
Is the continuation of the sql command entered in @command2 to apply to each user table with the replacement_character where the table name would normally be placed. 'sql_command' is nvarchar(2000)*, varchar(255)+ with a default of NULL. (Note: This parameter is not as useful on 7.0 since there are 4000 characters available in @command1)
[, [@whereand =] 'sql_command']
Is an additional where clause to limit the result set of the user table select. sql_command is nvarchar(2000)*, varchar(255)+ with a default of NULL. No wild card replacement occurs. It is added to the select that retrieves the user tables as passed to the procedure. It MUST be a valid where clause for a select against sysobjects.
[, [@precommand =] 'sql_command']
Is the sql command to be executed once before @command1 is processed. sql_command is nvarchar(2000)*, varchar(255)+ with a default of NULL. No wild card replacement occurs. It is executed as passed to the procedure.
[, [@postcommand =] 'sql_command']
Is the sql command to be executed once after @command1 is processed. sql_command is nvarchar(2000)*, varchar(255)+ with a default of NULL. No wild card replacement occurs. It is executed as passed to the procedure.
Return Code Values
0 (success) or @@ERROR (failure)
Result Sets
sp_MSforeachtable returns this message if no parameters are specified:
Procedure 'sp_MSforeachtable' expects parameter '@command1', which was not supplied.
Remarks
The procedure sp_MSforeachtable executes a set of commands against all the user tables in the current database. The sp_MSforeachtable procedure executes the precommand if entered. It then declares a cursor called hCForEach against sysobjects in the current database and passes the actual commands to be executed to sp_MSforeach_worker. The post command is then executed if entered.
Examples
Get the number of rows in each user table
sp_MSforeachtable 'print ''?'' select count(*) from ?'
sp_MSforeachtable 'select count(*) "?" from ?'
Grant SELECT permission to the developers on every user table
EXECUTE sp_MSforeachtable 'GRANT SELECT ON ? TO Developers'
Grant all permissions to the database maintenance role on every user meta data table
EXECUTE sp_MSforeachtable @command1 = 'PRINT ''?'' GRANT SELECT , INSERT , UPDATE , DELETE ON ? TO dbMaintenace', @whereand = 'AND name LIKE ''tbl%REF'' ORDER BY uid , name', @precommand = 'PRINT ''Granting permission on...''', @postcommand = 'PRINT ''Complete!'''
This is an exhaustive list of SQL Server undocumented stored procedures, yet to be explored by the world:
sp_MSchunkgeneration
sp_MSchunkgeneration
sp_MSgettools_path
sp_MSregistersubscription
sp_MSregistersubscription
sp_MSregistersubscription
sp_MS_upd_sysobj_category
sp_MSget_agent_names
sp_MSunregistersubscription
sp_MScleanup_conflict
sp_MSinit_replication_perfmon
sp_MSsubscription_enabled_for_syncmgr
sp_MSgetreplnick
sp_MSrepl_startup
sp_MSget_jobstate
sp_MSreplcheck_publish
sp_MShelpmergeconflictcounts
sp_MShelpmergeconflictcounts
sp_MSscriptmvastablenci
sp_MSflush_access_cache
sp_MSscript_pkvar_assignment
sp_MSscript_pkvar_assignment
sp_MSlocktable
sp_MShelpmergeconflictpublications
sp_MSscriptmvastablepkc
sp_MSreinit_failed_subscriptions
sp_MSreinit_failed_subscriptions
sp_MSget_publication_from_taskname
sp_MSenumcolumns
sp_MSclearcolumnbit
sp_MSscriptmvastableidx
sp_MSacquireHeadofQueueLock
sp_MSsetaccesslist
sp_MSscriptmvastable
sp_MSrepl_gettype_mappings
sp_MSacquireSlotLock
sp_MSreplcheck_pull
sp_MSreplcheck_pull
sp_MSreleaseSlotLock
sp_MSreplcheck_connection
sp_MSfix_6x_tasks
sp_MSfix_6x_tasks
sp_MSrepl_check_server
sp_MSrepl_PAL_rolecheck
sp_MShelpconflictpublications
sp_MSreset_synctran_bit
sp_MSreplcheck_qv
sp_MSenum_replsqlqueues
sp_MSenum_replqueues
sp_MSreplcheck_subscribe
sp_MScleanupmergepublisher
sp_MSreplicationcompatlevel
sp_MSaddpubtocontents
sp_MScleanupdynsnapshotvws
sp_MShelp_identity_property
sp_MShelp_identity_property
sp_MSget_subtypedatasrc
sp_MSpub_adjust_identity
sp_MSpub_adjust_identity
sp_MScleanupmergepublisherdb
sp_MScopysnapshot
sp_MScopysnapshot
sp_MSgenreplnickname
sp_MShelp_replication_table
sp_MSmergesubscribedb
sp_MScopyscriptfile
sp_MSenumallsubscriptions
sp_MSdrop_6x_replication_agent
sp_MSrepl_validate_dts_package
sp_MSenumsubscriptions
sp_MSenumsubscriptions
sp_MScomputemergearticlescreationorder
sp_MScomputemergearticlescreationorder
sp_MSreinit_article
sp_MSreinit_article
sp_MSget_load_hint
sp_MSenumallpublications
sp_MSenumallpublications
sp_MScomputemergeunresolvedrefs
sp_MScomputearticlescreationorder
sp_MScomputearticlescreationorder
sp_MSenumtranpublications
sp_MSCheckmergereplication
sp_MScomputeunresolvedrefs
sp_MSverifytranfilter
sp_MSenummergepublications
sp_MSgetpubinfo
sp_MShelptranconflictpublications
sp_MSenum3rdpartypublications
sp_MSaddmergedynamicsnapshotjob
sp_MSaddmergedynamicsnapshotjob
sp_MSaddmergedynamicsnapshotjob
sp_MShelptranconflictcounts
sp_MShelptranconflictcounts
sp_MSenumthirdpartypublicationvendornames
sp_MSdropmergedynamicsnapshotjob
sp_MSdropmergedynamicsnapshotjob
sp_MSgettranconflictrow
sp_MSagent_access_check
sp_MShelpmergedynamicsnapshotjob
sp_MSgettrancftsrcrow
sp_MSgettrancftsrcrow
sp_MSremove_userscript
sp_MSdeletetranconflictrow
sp_MSupdatesharedagentproperties
sp_MSupdatesharedagentproperties
sp_MSdrop_rlrecon
sp_MSdrop_rlrecon
sp_MSdrop_rlrecon
sp_MSdrop_rlrecon
sp_MSexternalfkreferences
sp_MSfetchidentityrange
sp_MSgetarticlereinitvalue
sp_MSfixupdistributorinfo
sp_MScheckidentityrange
sp_MSispkupdateinconflict
sp_MSfixupdistributorsecurity
sp_MShelpmergeidentity
sp_MSisnonpkukupdateinconflict
sp_MSrestore_sub_merge
sp_MSrestore_sub_merge
sp_MSrestore_sub_merge
sp_MSfixupftpinfo
sp_MShelpmergearticles
sp_MShelpmergearticles
sp_MShelpmergearticles
sp_MSrestore_sub_tran
sp_MSfixupaltsnapshotfolder
sp_MShelpmergeschemaarticles
sp_MSrestore_sub
sp_MSfixupworkingdirectory
sp_MScreateretry
sp_MSfixupuseftp
sp_MSdropretry
sp_MSprepare_sub_for_detach
sp_MSfixupagentoffloadinfo
sp_MSdroptemptable
sp_MSgetversion
sp_MSsub_check_identity
sp_MSfixupsharedagentproperties
sp_MSfixupsharedagentproperties
sp_MSchangearticleresolver
sp_MSpost_auto_proc
sp_MSsub_cleanup_orphans
sp_MSenumretries
sp_MSrepl_schema
sp_MSrepl_schema
sp_MSsub_cleanup_prop_table
sp_MSdeleteretry
sp_MSreplupdateschema
sp_MSreseed
sp_MSreseed
sp_MSaddlogin_implicit_ntlogin
sp_MSdeletepushagent
sp_MSdefer_check
sp_MSsub_set_identity
sp_MSget_pullsubsagent_owner
sp_MSgetonerow
sp_MSreenable_check
sp_MSinstance_qv
sp_MSuplineageversion
sp_MSdrop_repltran
sp_MSdrop_repltran
sp_MSdrop_repltran
sp_MSdrop_repltran
sp_MSdrop_repltran
sp_MSdrop_repltran
sp_MSdrop_repltran
sp_MSget_shared_agent
sp_MSgetlastrecgen
sp_MS_marksystemobject
sp_MSprep_exclusive
sp_MSdrop_pub_tables
sp_MSrepl_backup_start
sp_MStable_has_unique_index
sp_MSgetlastsentgen
sp_MSarticlecolstatus
sp_MSrepl_backup_complete
sp_MSchange_retention
sp_MSgetlastsentrecgens
sp_MSarticlecol
sp_MSadd_compensating_cmd
sp_MSadd_compensating_cmd
sp_MSchange_priority
sp_MSdummyupdate
sp_MSdummyupdate
sp_MScreate_pub_tables
sp_MScreate_pub_tables
sp_MScreate_pub_tables
sp_MScreate_pub_tables
sp_MSsetlastrecgen
sp_MSobjectprivs
sp_MSobjectprivs
sp_MSobjectprivs
sp_MSobjectprivs
sp_MSsetfilterparent
sp_MSsetlastsentgen
sp_MSdoesfilterhaveparent
sp_MSenumgenerations
sp_MSsetfilteredstatus
sp_MSget_setup_paths
sp_MScheckexistsgeneration
sp_MSdrop_rlcore
sp_MSdrop_rlcore
sp_MSretrieve_publication
sp_MSremoveoffloadparameter
sp_MSadduser_implicit_ntlogin
sp_MSchecksnapshotstatus
sp_MSguidtostr
sp_MSget_current_activity
sp_MSreplsup_table_has_pk
sp_MSaddoffloadparameter
sp_MScheck_uid_owns_anything
sp_MSget_mergepullsubsagent_owner
sp_MSenumreplicas
sp_MSgetconflicttablename
sp_MSset_current_activity
sp_MSset_current_activity
sp_MSenumdeletesmetadata
sp_MSuniqueobjectname
sp_MSobjsearch
sp_MSobjsearch
sp_MSobjsearch
sp_MSobjsearch
sp_MSUpgradeConflictTable
sp_MSUpgradeConflictTable
sp_MSreplraiserror
sp_MSenumpartialdeletes
sp_MSSetServerProperties
sp_MSuniquetempname
sp_MShasdbaccess
sp_MSsendtosqlqueue
sp_MSenumchanges
sp_MSsetalertinfo
sp_MSuniquecolname
sp_MSenumpartialchanges
sp_MSaddguidcolumn
sp_MShelpcolumns
sp_MShelpcolumns
sp_MShelpcolumns
sp_MShelpcolumns
sp_MSestimatemergesnapshotworkload
sp_MSestimatemergesnapshotworkload
sp_MSestimatemergesnapshotworkload
sp_MSestimatemergesnapshotworkload
sp_MSestimatemergesnapshotworkload
sp_MSestimatemergesnapshotworkload
sp_MSestimatemergesnapshotworkload
sp_MSpad_command
sp_MSinitdynamicsubscriber
sp_MSprepare_mergearticle
sp_MShelpindex
sp_MShelpindex
sp_MShelpindex
sp_MSestimatesnapshotworkload
sp_MSestimatesnapshotworkload
sp_MSestimatesnapshotworkload
sp_MSestimatesnapshotworkload
sp_MSestimatesnapshotworkload
sp_MSestimatesnapshotworkload
sp_MSflush_command
sp_MSgetrowmetadata
sp_MSgetcolumnlist
sp_MShelptype
sp_MShelptype
sp_MSis_col_replicated
sp_MSis_col_replicated
sp_MSget_colinfo
sp_MSgetmetadatabatch
sp_MSaddguidindex
sp_MSdependencies
sp_MSdependencies
sp_MSdependencies
sp_MSdependencies
sp_MSdependencies
sp_MSdependencies
sp_MSdropfkreferencingarticle
sp_MSget_col_position
sp_MSsetrowmetadata
sp_MSrefcnt
sp_MStablespace
sp_MSget_map_position
sp_MSinsertgenhistory
sp_MSgentablenickname
sp_MSindexspace
sp_MSmergeupdatelastsyncinfo
sp_MSget_type
sp_MSupdategenhistory
sp_MStablenickname
sp_MStablerefs
sp_MStablerefs
sp_MStablerefs
sp_MSrepl_FixPALRole
sp_MSrepl_FixPALRole
sp_MSscript_where_clause
sp_MSscript_where_clause
sp_MSscript_where_clause
sp_MSlocalizeinterruptedgenerations
sp_MStablenamefromnick
sp_MStablekeys
sp_MStablekeys
sp_MStablekeys
sp_MStablekeys
sp_MStablekeys
sp_MSscript_params
sp_MSenumschemachange
sp_MSgetmakegenerationapplock
sp_MStablechecks
sp_MSscript_article_view
sp_MSsetcontext_replagent
sp_MSscript_procbodystart
sp_MSenumschemachange_70
sp_MSreleasemakegenerationapplock
sp_MSsettopology
sp_MSscript_begintrig1
sp_MSscript_begintrig1
sp_MSenumschemachange_80
sp_MSenumschemachange_80
sp_MSenumschemachange_80
sp_MSmakegeneration
sp_MSmakegeneration
sp_MSmakegeneration
sp_MSmakegeneration
sp_MSmatchkey
sp_MSaddexecarticle
sp_MSaddexecarticle
sp_MSaddexecarticle
sp_MSdrop_replcom
sp_MSdrop_replcom
sp_MSdrop_replcom
sp_MSdrop_replcom
sp_MSdrop_replcom
sp_MSdrop_replcom
sp_MSscript_begintrig2
sp_MSscript_begintrig2
sp_MSenumschemachange_80sp3
sp_MSenumschemachange_80sp3
sp_MSenumschemachange_80sp3
sp_MSenumschemachange_80sp3
sp_MSfixlineageversions
sp_MSfixlineageversions
sp_MSforeach_worker
sp_MSforeach_worker
sp_MSaddschemaarticle
sp_MSaddschemaarticle
sp_MScreate_distributor_tables
sp_MScreate_distributor_tables
sp_MScreate_distributor_tables
sp_MScreate_distributor_tables
sp_MScreate_distributor_tables
sp_MScreate_distributor_tables
sp_MScreate_distributor_tables
sp_MScreate_distributor_tables
sp_MScreate_distributor_tables
sp_MSscript_endtrig
sp_MSupdateschemachange
sp_MSaddupdatetrigger
sp_MSaddupdatetrigger
sp_MSaddupdatetrigger
sp_MSforeachdb
sp_MSscript_trigger_variables
sp_MSscript_trigger_variables
sp_MSremove_mergereplcommand
sp_MSaddmergetriggers
sp_MSaddmergetriggers
sp_MSaddmergetriggers
sp_MSaddmergetriggers
sp_MSforeachtable
sp_MSgettranconflictname
sp_MSIfExistsRemoteLogin
sp_MSscript_trigger_assignment
sp_MSadd_mergereplcommand
sp_MSadd_mergereplcommand
sp_MSchangeobjectowner
sp_MSloginmappings
sp_MSmaketrancftproc
sp_MSmaketrancftproc
sp_MSmaketrancftproc
sp_MSmaketrancftproc
sp_MSmaketrancftproc
sp_MSmaketrancftproc
sp_MSscript_trigger_fetch_statement
sp_MSsetreplicainfo
sp_MShelpdestowner
sp_MScleanuptask
sp_MSuniquename
sp_MSreplrole
sp_MSscript_trigger_exec_rpc
sp_MSscript_trigger_exec_rpc
sp_MSscript_trigger_exec_rpc
sp_MSscript_trigger_exec_rpc
sp_MSsetreplicastatus
sp_MSfillupmissingcols
sp_MSkilldb
sp_MSscript_trigger_update_checks
sp_MScreateglobalreplica
sp_MScreateglobalreplica
sp_MSmaptype
sp_MSchangeschemaarticle
sp_MSchangeschemaarticle
sp_MShelpobjectpublications
sp_MSscript_trigger_updates
sp_MSsetconflictscript
sp_MSquerysubtype
sp_MSSQLDMO80_version
sp_MSscript_trigger_version_updates
sp_MSsetconflicttable
sp_MSSQLDMO70_version
sp_MSscript_singlerow_trigger
sp_MSmakeconflictinsertproc
sp_MSmakeconflictinsertproc
sp_MSmakeconflictinsertproc
sp_MSsethighestversion
sp_MSSQLOLE65_version
sp_MSscript_multirow_trigger
sp_MSmaketempinsertproc
sp_MSSQLOLE_version
sp_MSscript_sync_ins_trig
sp_MSgetconflictinsertproc
sp_MSgetconflictinsertproc
sp_MSpurgecontentsorphans
sp_MSscriptdatabase
sp_MSscript_sync_upd_trig
sp_MSinsertdeleteconflict
sp_MScleanup_zeroartnick_genhistory
sp_MSscriptdb_worker
sp_MSscript_sync_del_trig
sp_MScheckmetadatamatch
sp_MSdelete_specifiedcontents
sp_MSdbuseraccess
sp_MSdbuseraccess
sp_MSdbuseraccess
sp_MSget_synctran_column
sp_MSdelrow
sp_MSdelrow
sp_MSispulldistributionjobnamegenerated
sp_MSdrop_rladmin
sp_MSdrop_rladmin
sp_MSdrop_rladmin
sp_MSdrop_rladmin
sp_MSdbuserpriv
sp_MSdbuserpriv
sp_MSpublishdb
sp_MSsetartprocs
sp_MSsetartprocs
sp_MSispullmergejobnamegenerated
sp_MSaddmergepub_snapshot
sp_MSaddmergepub_snapshot
sp_MShelpfulltextindex
sp_MSactivate_auto_sub
sp_MSmakesystableviews
sp_MSmakesystableviews
sp_MSdropmergepub_snapshot
sp_MShelpfulltextscript
sp_MSget_synctran_commands
sp_MSget_synctran_commands
sp_MSget_synctran_commands
sp_MSget_synctran_commands
sp_MSgetchangecount
sp_MScheckatpublisher
sp_MSbelongs
sp_MSbelongs
sp_MSaddmergeschemaarticle
sp_MSaddmergeschemaarticle
sp_MSGetServerProperties
sp_MSaddpub_snapshot
sp_MSaddpub_snapshot
sp_MSexpandbelongs
sp_MSis_pk_col
sp_MScheck_agent_instance
sp_MSexpandnotbelongs
sp_MSchangemergeschemaarticle
sp_MSchangemergeschemaarticle
sp_MSSharedFixedDisk
sp_MSmark_proc_norepl
sp_MSBumpupCompLevel
sp_MSsetupbelongs_withoutviewproc
sp_MSfilterclause
sp_MSdrop_expired_subscription
sp_MSdrop_expired_subscription
sp_MSCleanupForPullReinit
sp_MSsetupnotbelongs
sp_MSadjustmergeidentity
sp_MSadjustmergeidentity
sp_MSgetalertinfo
sp_MSscript_validate_subscription
sp_MSpublicationcleanup
sp_MSpublicationcleanup
sp_MSsetupworktables
sp_MSsetupworktables
sp_MSsetupworktables
sp_MSvalidate_subscription
sp_MScreate_dist_tables
sp_MScreate_dist_tables
sp_MScreate_dist_tables
sp_MScreate_dist_tables
sp_MScreate_dist_tables
sp_MScreate_dist_tables
sp_MScreate_dist_tables
sp_MScreate_dist_tables
sp_MScreate_dist_tables
sp_MScreate_dist_tables
sp_MScreate_dist_tables
sp_MSsetupbelongs
sp_MSsetupbelongs
sp_MSsetupbelongs
sp_MSsetupbelongs
sp_MSdroparticleconstraints
sp_MSscript_insert_statement
sp_MSscript_insert_statement
sp_MSupdate_mqserver_distdb
sp_MSarticlecleanup
sp_MSarticlecleanup
sp_MSaddinitialarticle
sp_MSaddinitialarticle
sp_MSacquireserverresourcefordynamicsnapshot
sp_MSadd_distributor_alerts_and_responses
sp_MSadd_distributor_alerts_and_responses
sp_MSdroparticleprocs
sp_MSaddinitialschemaarticle
sp_MSscript_insert_subwins
sp_MSdrop_distributor_alerts_and_responses
sp_MSdrop_distributor_alerts_and_responses
sp_MSdroparticletriggers
sp_MSaddinitialpublication
sp_MSaddinitialpublication
sp_MSis_identity_insert
sp_MSaddinitialsubscription
sp_MSaddinitialsubscription
sp_MSscript_compensating_send
sp_MSmakearticleprocs
sp_MSgettranlastupdatedtime
sp_MSscriptinsertconflictfinder
sp_MSscriptinsertconflictfinder
sp_MSupdatesysmergearticles
sp_MSgetmergelastupdatedtime
sp_MSscript_insert_pubwins
sp_MSscript_insert_pubwins
sp_MSrepl_addrolemember
sp_MSexclause
sp_MSgetlastupdatedtime
sp_MSscript_update_statement
sp_MSscript_update_statement
sp_MSrepl_droprolemember
sp_MSgetcolordinalfromcolname
sp_MSreinitmergepublication
sp_MSinsertbeforeimageclause
sp_MSreinit_hub
sp_MSscript_update_subwins
sp_MScreatedupkeyupdatequery
sp_MScreatedupkeyupdatequery
sp_MSscriptupdateconflictfinder
sp_MSscriptupdateconflictfinder
sp_MSscriptupdateconflictfinder
sp_MSscriptupdateconflictfinder
sp_MSscriptupdateconflictfinder
sp_MSscriptupdateconflictfinder
sp_MSmakeinsertproc
sp_MSmakeinsertproc
sp_MSmakeinsertproc
sp_MSpublicationview
sp_MSpublicationview
sp_MSpublicationview
sp_MSpublicationview
sp_MSpublicationview
sp_MSpublicationview
sp_MSpublicationview
sp_MSpublicationview
sp_MSpublicationview
sp_MSscript_update_pubwins
sp_MSscript_update_pubwins
sp_MSscript_update_pubwins
sp_MSremovedbreplication
sp_MSmakeupdateproc
sp_MSmakeupdateproc
sp_MSmakeupdateproc
sp_MSmakeupdateproc
sp_MSscript_delete_statement
sp_MSmakeselectproc
sp_MSmakeselectproc
sp_MSretrieve_mergepublication
sp_MSscript_delete_subwins
sp_MScopyregvalue
sp_MSdropconstraints
sp_MSscriptdelconflictfinder
sp_MSinsertschemachange
sp_MSreplcheckoffloadserver
sp_MSscript_compensating_insert
sp_MSscript_compensating_insert
sp_MSscript_compensating_insert
sp_MSscript_compensating_insert
sp_MSscript_compensating_insert
sp_MSscript_compensating_insert
sp_MSscript_compensating_insert
sp_MSgetviewcolumnlist
sp_MSscript_delete_pubwins
sp_MSvalidatearticle
sp_MSget_file_existence
sp_MShelpvalidationdate
sp_MSscript_beginproc
sp_MSsubscriptionvalidated
sp_MSrepl_isdbowner
sp_MSmergepublishdb
sp_MSscript_security
sp_MSdroparticletombstones
sp_MSscript_endproc
sp_MSproxiedmetadata
sp_MSget_qualified_name
sp_MStable_not_modifiable
sp_MSupdate_agenttype_default
sp_MScontractsubsnb
sp_MSdrop_object
sp_MSscript_ExecutionMode_stmt
sp_MSexpandsubsnb
sp_MSscript_sync_ins_proc
sp_MSvalidate_agent_parameter
sp_MSvalidate_agent_parameter
sp_MSvalidate_agent_parameter
sp_MSvalidate_agent_parameter
sp_MSvalidate_agent_parameter
sp_MSdelsubrows
sp_MSdelsubrows
sp_MSscript_sync_upd_proc
sp_MSdelsubrowsbatch
sp_MSdelsubrowsbatch
sp_MSdelsubrowsbatch
sp_MSdelsubrowsbatch
sp_MSsubst_filter_name
sp_MSscript_dri
sp_MSscript_sync_del_proc
sp_MSscriptviewproc
sp_MSscriptviewproc
sp_MSsubst_filter_names
sp_MSenumpubreferences
sp_MSscript_pub_upd_trig
sp_MSmakeviewproc
sp_MSreplcheck_name
sp_MSsubsetpublication
sp_MSmakeconflicttable
sp_MSmakeconflicttable
sp_MSmakeconflicttable
sp_MSget_publisher_rpc
sp_MScreatebeforetable
sp_MScheckvalidsystables
sp_MSindexcolfrombin
sp_MShelp_distdb
sp_MShelpcreatebeforetable
sp_MShelpcreatebeforetable
sp_MSdrop_mergesystables
sp_MSmakejoinfilter
sp_MSgen_sync_tran_procs
sp_MSgen_sync_tran_procs
sp_MSupdate_replication_status
sp_MSupdate_replication_status
sp_MSreset_queue
sp_MShelpalterbeforetable
sp_MShelpalterbeforetable
sp_MScreate_mergesystables
sp_MScreate_mergesystables
sp_MScreate_mergesystables
sp_MScreate_mergesystables
sp_MScreate_mergesystables
sp_MScreate_mergesystables
sp_MSmakeexpandproc
sp_MSmakeexpandproc
sp_MSmakeexpandproc
sp_MSenum_misc_agents
sp_MSreset_queued_reinit
sp_MSgetbeforetableinsert
sp_MStestbit
sp_MSdrop_expired_mergesubscription
sp_MSdrop_expired_mergesubscription
sp_MSload_replication_status
sp_MSinit_subscription_agent
sp_MSfixupbeforeimagetables
sp_MSsetbit
sp_MScleanup_metadata
sp_MScleanup_metadata
sp_msupg_removesystemcomputedcolumns
sp_MSareallcolumnscomputed
sp_MScreate_replication_status_table
sp_MSupdatelastsyncinfo
sp_MSreplcheck_permission
sp_MSinsertcontents
sp_MSgettypestringudt
sp_MShelp_replication_status
sp_MShelp_replication_status
sp_MSget_attach_state
sp_MSinserterrorlineage
sp_MSupdatecontents
sp_MSquiescecheck
sp_MSenum_replication_agents
sp_MSenum_replication_agents
sp_MSenum_replication_agents
sp_MSreset_attach_state
sp_MSevalsubscriberinfo
sp_MSdeletecontents
sp_MSset_subscription_properties
sp_MSsetsubscriberinfo
sp_MSunmarkifneeded
sp_MSpreparecleanup
sp_MSscript_missing_row_check
sp_MScreate_replication_checkup_agent
sp_MSset_sub_guid
sp_MSgetsubscriberinfo
sp_MSunmarkreplinfo
sp_MSquiescetriggerson
sp_msupg_recreatecatalogfaketables
sp_MSenum_replication_job
sp_MSmakectsview
sp_MSmakectsview
sp_MSmakectsview
sp_MSmarkreplinfo
sp_MSquiescetriggersoff
sp_msupg_dosystabcatalogupgrades
sp_msupg_dosystabcatalogupgrades
sp_msupg_dosystabcatalogupgrades
sp_MSrepl_dbrole
sp_MScreate_sub_tables
sp_MScreate_sub_tables
sp_MScreate_sub_tables
sp_MSinsertgenerationschemachanges
sp_MSinsertgenerationschemachanges
sp_MSunmarkschemaobject
sp_MSquiesceforcleanup
sp_msupg_dropcatalogcomputedcols
sp_MSupdate_mqserver_subdb
sp_MSalreadyhavegeneration
sp_MSmarkschemaobject
sp_msupg_createcatalogcomputedcols
sp_msupg_createcatalogcomputedcols
sp_msupg_createcatalogcomputedcols
sp_MS_replication_installed
sp_MSgettablecontents
sp_MSaddanonymousreplica
sp_MScompletecleanup
sp_MScompletecleanup
sp_msupg_recreatesystemviews
sp_MSget_oledbinfo
sp_MSunc_to_drive
sp_MSdelgenzero
sp_MSgetreplicainfo
sp_MSpropagateschematorepubs
sp_msupg_upgradecatalog
sp_MSretrieve_publication_attributes
sp_MSmakedynsnapshotvws
sp_MSmakedynsnapshotvws
sp_MSmakedynsnapshotvws
sp_MSmakedynsnapshotvws
sp_MSadd_repl_job
sp_MSadd_repl_job
sp_MSadd_repl_job
sp_MScleanup_publication_ADinfo
sp_MSdropdynsnapshotvws
sp_MScheck_subscription
sp_MScleanup_conflict_table
sp_MSrepl_linkedservers_rowset
Tuesday, June 29, 2004
Meta Reunion
I would love to do this with my associations with other organizations too viz.: Genesys & Mediline, oneway it helps get a feedback of oneself on how you treated your team and vice-versa.
Well there is a community created on Orkut called Meta Alumni. If you have not received my invitation, do ping me.
Tuesday, June 22, 2004
Break through firewall
No configuration hassles, no techie-talk or geek-speak. Not only does hopster configure itself, it even knows how to configure Kazaa, MSN Messenger and many others - so you don't need to.
Once installed, hopster operates silently in the background, you won't even notice it's there.
Hopster was designed with the most popular applications in mind: MSN Messenger, ICQ, Yahoo Messenger, Trillian... no matter where your friends are, hopster gets you there. And so are they adding more apps every day.
Hopster also protects you from the nosy Bad Guys on the 'net.
It hides your actual ip address, making it impossible for hackers to trace you. And their firewalls protect you from unwanted visitors.
Download Now
On downloading the demo version, if you get annonyed with the ad bar right click on the title bar and click minimize, this will hide the ad bar for ever and you don't need to buy it unless you need more than 4kb/sec data.
Wednesday, June 09, 2004
Visio to anything
Couple of weeks back i got myself actively involved with the design team and realized that most of the time was spent in getting the class diagrams from Visio (modelling tool) and stored procedures documented as per the custom design document template.
Technologies
- Visio,
- .NET Office Extensibility Add-in,
- MS Word,
- VBA,
- XMI,
- XSL,
- CSS
Approach:
Visio does provide a reporting add-in but unfortunately it is neither readable nor is it customizable and so started the thought to work on an alternative.
Microsoft always has a means to automate/customize/extend their products and so do they have UML to XMI Export Functionality, meaning a Visio UML Model can be exported to XML Metadata Interchange (XMI) format. This is build using .NET Office extensibility Add-in.
Now the XMI that is generated by Visio uses UML.dtd, which unfortunately is not distributed by Microsoft but have provided the resource in the readme.txt. With XMI & DTD in place i am sure of a valid Visio XMI file.
The next step was to display the XMI data in a custom format and the best alternative was to use eXtensible Stylesheet Language (XSL), now I needed to understand the structure of Visio XMI file and this is a tough job because there is no documentation available whatsoever to understand how visio model is interpretted in XMI format.
Attached a CSS to XSL to apply the formatting styles including header styles.
The next step was to place this information at an appropriate postion with in the design document template, hence created a .dot file, which is a template file for word.
Created a macro in word VBA that will use MSXML 2.0/4.0 and dynamically translate XMI with XSL and insert it into appropriate position.
Rebuild the table of contents, which will now include the design headings as defined by the CSS.
Please do drop me a comment if you need the UML to XMI add-in/DTD/XSL/CSS/DOT.
Custom Datagrid
This datagrid custom webcontrol will provide out of the box functionalities for the following features:
- CAT Stylesheet for HeadingItemStyle, EditItemStyle, SelectedItemStyle
- Inline of Page Redirect on Edit
- Captions for Edit, Update, Cancel & Delete buttons can be either text or graphic
- On double click of any row, editcommand, pageredirect of the row will be performed
- On single click of any row, selectcommand will be performed on the client end, thus saving the roundtrip to server.
- Sorting of the columns ASC/DESC on corresponding clicks on the column header with glmph
- Paging of the datagrid
- Maintaining State Across Pages For Checked Records
- Complement Inline Edit & Delete Support
- Fully Editable Support
- Maintains Concurrency Checks For InlineEdit Records
- Makes A Particular Row or Column ReadOnly
/// <summary>
/// File Name: EMSDataGrid.cs
/// Description:
///<Author> Amith Ellur & Yasin Mukadam</Author>
///<Date> 11-Feb-2004</Date>
///<Description>This datagrid custom webcontrol will provide out of the box functionalities for the following:
///1.   CAT Stylesheet for HeadingItemStyle, EditItemStyle, SelectedItemStyle
///2.   Inline of Page Redirect on Edita
///3.   Captions for Edit, Update, Cancel & Delete buttons can be either text or graphic
///4.   On double click of any row, editcommand, pageredirect of the row will be performed
///5.   On single click of any row, selectcommand will be performed on the client end,
///thus saving the roundtrip to server.
///6.  Sorting of the columns ASC/DESC on corresponding clicks on the column header
///7.  Paging of the datagrid
///8.  Maintaining State Across Pages For Checked Records
///9.  Complement Inline Edit & Delete Support
///10. Fully Editable Support
///11. Maintains Concurrency Checks For InlineEdit Records
///12. Makes A Particular Row or Column ReadOnly
///</Description>
/// </summary>
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Collections;
using System.Text;
using System.IO;
using Caterpillar.Ems;
using System.Text.RegularExpressions;
using System.Web.Handlers;
using System.Globalization;
using System.Web;
namespace Caterpillar.Ems.Controls
{
/// Summary description for EMSDataGrid.
/// </summary>
[DefaultProperty("Text"),
ToolboxData("<{0}:EMSDataGrid runat=server></{0}:EMSDataGrid>")]
public class EMSDataGrid : System.Web.UI.WebControls.DataGrid
{
/// <summary>
///  Used To Set The Default Validator Control Style Sheet
/// </summary>
const string VALIDATORSTYLESHEET = "RequiredFieldValidator"
/// <summary>
/// Used To Set The Default Range Validator Control Error Message
/// </summary>
const string RANGEERRORMESSAGE = "<BR><BLINK>||Invalid Data||</BLINK>"
/// <summary>
/// Used To Set The Default Required Validator Control Error Message
/// </summary>
const string REQUIREDERRORMESSAGE = "<BR><BLINK>||Required||</BLINK>"
/// <summary>
/// Used To Set The Default Regular Validator Control Error Message
/// </summary>
const string REGULARERRORMESSAGE = "<BR><BLINK>||Invalid Format||</BLINK>"
/// <summary>
/// Used To Set The Default Custom Validator Control Error Message
/// </summary>
const string CUSTOMERRORMESSAGE = "<BR><BLINK>||Custom Validation Failed||</BLINK>"
/// <summary>
///  Used To Set The Default DropDown Text
/// </summary>
const string DROPDOWNDEFAULTTEXT = "||-SELECT-||"
/// <summary>
/// Used To Set The DropDownStyle Attribute
/// </summary>
const string DROPDOWNSTYLE = "DropDownStyle"
/// <summary>
/// Name Of The Hidden CheckboxState Control
/// </summary>
const string HIDDENCHECKSTATE = "hiddencheckstate"
/// <summary>
/// Name Of The Hidden Control For Storing The NoOfRecordsChecked
/// </summary>
const string HIDDENNORECORDSCHECKBOXSTATE = "hiddennoofrecordscheckboxstate"
/// <summary>
/// Name Of The Hidden Control For Storing The Total Number Of Records
/// </summary>
const string HIDDENCHECKBOXSTATECOUNT = "hiddencheckboxstatecount"
/// <summary>
/// Name Of The hidden Control To Store CheckBox State
/// </summary>
const string HIDDENCONCURRENCYSTATE = "hiddenconcurrencystate"
/// <summary>
/// Name Of The HiddenControlWhich Stores The PreviousPage
/// </summary>
const string HIDDENPREVIOUSPAGE = "hiddenpreviouspage"
/// <summary>
/// Name Of The ReadOnly TextBoxStyle
/// </summary>
const string READONLYTEXTBOXSTYLE = "ReadOnlyTextBoxStyle"
/// <summary>
/// Name Of The TextBoxStyle
/// </summary>
const string TEXTBOXSTYLE = "TextBoxStyle"
/// <summary>
/// Name Of The hidden Control Used For Validating The Selected Record Id
/// </summary>
const string HIDDENCONCURRENCYIDCONCTROL = "hiddenconcurrencyidcontrol"
#endregion
#region Member Variables
/// <summary>
/// Defined enumerations for the different types of edit, delete, caption and stylesheet use
/// </summary>
public enum EditType { UnAuthorized = 0, InLine = 1, PageRedirect = 2 };
/// <summary>
/// Defined enumeration for the different type of delete message
/// </summary>
public enum DeleteType { DeleteWithConfirmation = 0, DeleteWithOutConfirmation = 1 };
/// <summary>
/// Defined enumeration for the different type of caption Type
/// </summary>
public enum CaptionType { Text = 0, Graphics = 1 };
/// <summary>
/// Used To Specify The Default Style Sheet
/// </summary>
public enum StyleSheetType { None = 0, CAT = 1, Default = 2 };
/// <summary>
/// Used To Specify The Status Of The Edit Button
/// </summary>
private bool editVisible;
/// <summary>
/// Used To Specify The Status Of The Delete Button
/// </summary>
private DeleteType allowDelete;
/// <summary>
/// Used To Specify The Status Of The Delete Button
/// </summary>
private bool deleteVisible;
/// <summary>
/// Used To Specify The Control Caption
/// </summary>
private CaptionType controlCaption;
/// <summary>
/// Used To Specifiy The Style Sheet Type
/// </summary>
private StyleSheetType styleSheet;
/// <summary>
/// Used To Specify The Status Of Edit On Double Click
/// </summary>
private bool editOnDoubleClick;
/// <summary>
/// Used To Specify The Status Of The Edit On single Click
/// </summary>
private bool selectOnSingleClick;
/// <summary>
/// Used To Specify The Id Of The Currently Selected Record On The Client Side
/// </summary>
private string keyHiddenControlId;
/// <summary>
/// Used To Specify The Status Of Fully Editable Grid
/// </summary>
private bool blnFullEdidtable;
/// <summary>
/// Used To Specify The Status Of The Inline Edit Enhance Features
/// </summary>
private bool blnEnhanceEdit;
/// <summary>
/// Stores The DataMembers Extended Properties For Each DataColumn
/// </summary>
private System.Data.PropertyCollection PropertyCollection;
/// <summary>
/// Stores The Max Decimal Value
/// </summary>
private string DecimalMaxValue = System.Configuration.ConfigurationSettings.AppSettings["DecimalMaxValue"];
/// <summary>
/// Stores The Min Decimal Value
/// </summary>
private string DecimalMinValue = System.Configuration.ConfigurationSettings.AppSettings["DecimalMinValue"];
/// <summary>
/// DataTable Which Contains The Modified Data Of The DataGrid After An Post Back From Inline Edit Or Fully Editable grid
/// </summary>
private DataTable dtModifiedDataTable = new DataTable();
/// <summary>
/// Maintains The Status Of The CheckBox State
/// </summary>
private bool blnCheckBoxState;
/// <summary>
/// Column Number From The DataMember On Which To Maintain The CheckBox State
/// </summary>
private int intCheckBoxColumn;
/// <summary>
/// Hidden Control Name Of The CheckBoxState Property
/// </summary>
private string strHiddenCheckBoxState;
/// <summary>
/// Hidden Control Name Of The CheckBoxState Property
/// </summary>
private string strNoOfRecordsCheckBoxState;
/// <summary>
/// Hidden Control Name Of The CheckBoxState Property
/// </summary>
private string strCheckBoxStateCount;
/// <summary>
/// Hidden Control Name Of The Previously Selected Page
/// </summary>
private string strHiddenPreviousPage;
/// <summary>
/// Number Of Records Selected For The Current Page
/// </summary>
private int intNoOfRecordsCheckBoxState = 0;
/// <summary>
/// DataSet Which Contains The CheckBox Ids For All The Pages
/// </summary>
private DataSet dsCheckBoxState;
/// <summary>
/// Stores The Name Of The Hidden Control Of Header Column
/// </summary>
private string strHeaderCheckBoxId = string.Empty;
/// <summary>
/// Hidden Control Which Stores The Id Of The Currently Selected Row On The Client Side
/// </summary>
private HtmlInputHidden hidConcurrencyIdControl = new HtmlInputHidden();
/// <summary>
/// Hidden Control Which Stores The Id Of The Currently Selected Row On The Client Side
/// </summary>
private string strConcurrencyIdControl;
/// <summary>
///
/// </summary>
private bool blnClearGridStatus = false;
#endregion
#region Events
/// <summary>
/// define the events for EMS DataGrid. This will be listed under EMS Events
/// </summary>
[Category("EMS Events"), Description("Fires when edit is clicked.")]
public event DataGridCommandEventHandler EditPage;
/// <summary>
///
/// </summary>
public event EMSExceptionEventHandler EMSDataGridRaiseException;
#endregion
#region Properties
/// <summary>
/// Attribute of the control to contain AllowEdit.
/// This will say if we need to provide edit functionality
/// </summary>
[Category("EMS Properties"), DefaultValue(""), Description("Specify if edit option is to be made available.")]
public EditType AllowEdit
{
{
{
else
{
set
{
{
/// <summary>
/// Attribute of the control to contain KeyHiddenControlId.
/// This will contain the id of the field to which the datagrid is associated for different functions
/// This will be the id of the associated control
/// </summary>
[Category("EMS Properties"), DefaultValue(""), Description("Specify the field in which the primary key value has to be displayed.")]
public string KeyHiddenControlId
{
{
set
{
/// <summary>
/// Attribute of the control to contain AllowDelete.
/// This will say if we need to provide delete functionality
/// </summary>
[Category("EMS Properties"), DefaultValue(""), Description("Specify if delete option is to be made available.")]
public DeleteType AllowDelete
{
{
set
{
/// <summary>
/// Attribute of the control to contain controlCaption.
/// This will say what kind of caption is used
/// </summary>
[Category("EMS Properties"), DefaultValue(""), Description("Specify the caption style for the edit and delete columns.")]
public CaptionType ControlCaption
{
{
set
{
/// <summary>
/// Attribute of the control to contain StyleSheet.
/// This will say what kind of StyleSheet is used
/// </summary>
[Category("EMS Properties"), DefaultValue(""), Description("Specify the style sheet to be used to render the rows.")]
public StyleSheetType StyleSheet
{
{
set
{
/// <summary>
/// Attribute of the control to contain EditOnDoubleClick.
/// This will say if we need to provide edit functionality on row double click as well
/// </summary>
[Category("EMS Properties"), DefaultValue(""), Description("Specify if edit to be made available on double clicking the row.")]
public bool EditOnDoubleClick
{
{
set
{
/// <summary>
/// Attribute of the control to contain SelectOnSingleClick.
/// This will say if we need to provide select functionality on row single click as well
/// </summary>
[Category("EMS Properties"),
DefaultValue(""), Description("Specify if the row has to be selected on single click.")]
public bool SelectOnSingleClick
{
{
set
{
/// <summary>
/// Attribute of the control to contain EditVisible.
/// This will say if edit link on the grid will be displayed or not
/// </summary>
[Category("EMS Properties"), DefaultValue(""), Description("Specify if the edit column is to be displayed.")]
public bool EditVisible
{
{
set
{
/// <summary>
/// Attribute of the control to contain EditVisible.
/// This will say if delete link on the grid will be displayed or not
/// </summary>
[Category("EMS Properties"), DefaultValue(""), Description("Specify if the delete column is to be displayed.")]
public bool DeleteVisible
{
{
set
{
/// <summary>
/// Specify if the Grid Will Be Fully Editable
/// </summary>
[Category("EMS Properties"), DefaultValue(""), Description("Specify if the Grid Will Be Fully Editable.")]
public bool FullEditable
{
{
set
{
/// <summary>
/// Specify if the Grid Will Be Contain Enhance Features For Enline Edit.
/// </summary>
[Category("EMS Properties"), DefaultValue(""), Description("Specify if the Grid Will Be Contain Enhance Features For Enline Edit.")]
public bool EnhanceEdit
{
{
set
{
/// <summary>
/// Returns The Updated DataSet Of The Grid i.e. When The Update Event Is Fired.
/// </summary>
[Category("EMS Properties"), DefaultValue(""), Description("Returns The Updated DataSet Of The Grid i.e. When The Update Event Is Fired.")]
public DataSet ModifiedDataSet
{
{
{
this.dtModifiedDataTable.TableName = ((DataView)this.DataSource).Table.TableName;
//((DataView)this.DataSource).DataSetName
DataSet ds = new DataSet();
ds.Tables.Add(this.dtModifiedDataTable);
this.EditItemIndex = -1;
return ds;
/// <summary>
/// Speficies If The CheckBox State Is Going To Be Maintained Accross Pages.
/// </summary>
[Category("EMS Properties"), DefaultValue(""), Description("Speficies If The CheckBox State Is Going To Be Maintained Accross Pages.")]
public bool CheckBoxState
{
{
set
{
/// <summary>
/// Column Number Of The DataSource Of Which To Maintain State.
/// </summary>
[Category("EMS Properties"), DefaultValue(""), Description("Column Number Of The DataSource Of Which To Maintain State.")]
public int CheckBoxColumn
{
{
set
{
/// <summary>
/// Returns The DataSet For Checked Columns Accross Pages.
/// </summary>
[Category("EMS Properties"), DefaultValue(""), Description("Returns The DataSet For Checked Columns Accross Pages.")]
public DataSet ReadCheckBoxStateData
{
{
if (this.blnCheckBoxState)
{
this.WriteHiddenControl();
//Validating If The DataSet Exists
if (!object.Equals(this.dsCheckBoxState, null))
{
if (!object.Equals(this.dsCheckBoxState.Tables[this.DataMember.ToString()], null))
{
if (this.dsCheckBoxState.Tables[this.DataMember.ToString()].Rows.Count == 0)
{
return null;
else
{
//this.ClearCheckBoxState();
//Returning The Newly Populated DataSet
return this.dsCheckBoxState;
else
{
return null;
else
{
return null;
else
{
return null;
/// <summary>
/// Returns The Hidden Control Id Which Contain The No Of Records Checked For Current Page.
/// </summary>
[Category("EMS Properties"), DefaultValue(""), Description("Returns The Hidden Control Id Which Contain The No Of Records Checked For Current Page.")]
public string NoOfRecordsCheckBoxState
{
{
/// <summary>
/// Returns The Hidden Control Id Which Contain The No Of Records Checked For All The Pages.
/// </summary>
[Category("EMS Properties"), DefaultValue(""), Description("Returns The Hidden Control Id Which Contain The No Of Records Checked For All The Pages.")]
public string CheckBoxStateCount
{
{
/// <summary>
/// Returns The Hidden Control Id Which Contain The checkBox State.
/// </summary>
[Category("EMS Properties"), DefaultValue(""), Description("Returns The Hidden Control Id Which Contain The checkBox State.")]
public string HiddenCheckBoxState
{
{
/// <summary>
/// Specifies To Clear The DataSet From The ViewState.
/// </summary>
[Category("EMS Properties"), DefaultValue(""), Description("Specifies To Clear The DataSet From The ViewState.")]
public void ClearCheckBoxState()
{
if (!object.Equals(this.ViewState[this.strHiddenCheckBoxState], null))
{
//
this.blnClearGridStatus = true;
#endregion
#region OverReidden Events And Method Of The DataGrid
#region Events That Get Fired Each Time The DataGrid Is Processed
/// <summary>
/// calling the EMS Datagrid Constructor
/// </summary>
public EMSDataGrid()
{
this.ShowHeader = true;
this.AutoGenerateColumns = false;
//this.AllowSorting = true;
this.BorderColor = Color.Black;
this.BorderStyle = BorderStyle.Solid;
// Set the Handlers for the events to be handled in EMS Datagrid
CancelCommand += new DataGridCommandEventHandler(EMSDataGrid_CancelCommand);
EditCommand += new DataGridCommandEventHandler(EMSDataGrid_EditCommand);
UpdateCommand += new DataGridCommandEventHandler(EMSDataGrid_UpdateCommand);
SortCommand += new DataGridSortCommandEventHandler(EMSDataGrid_SortCommand);
DataBinding += new EventHandler(EMSDataGrid_DataBinding);
PageIndexChanged += new DataGridPageChangedEventHandler(EMSDataGrid_PageIndexChanged);
/// <summary>
/// Get Fired When The Instance If The Grid Is Fired
/// </summary>
/// <param name="e"></param>
protected override void OnInit(EventArgs e)
{
this.Columns.Clear();
if (this.AllowPaging || this.AllowCustomPaging)
{
this.PagerStyle.Mode = PagerMode.NumericPages;
this.PagerStyle.HorizontalAlign = HorizontalAlign.Left;
this.PageSize = int.Parse(System.Configuration.ConfigurationSettings.AppSettings["RowsPerPage"].ToString());
if (object.Equals(this.NamingContainer.ClientID, null))
{
else
{
//Validating If The CheckBoxState Has To Be Maintained
if (this.blnCheckBoxState)
{
if (object.Equals(this.NamingContainer.ClientID, null))
{
this.strNoOfRecordsCheckBoxState = this.ClientID + ":" + HIDDENNORECORDSCHECKBOXSTATE;
this.strCheckBoxStateCount = this.ClientID + ":" + HIDDENCHECKBOXSTATECOUNT;
this.strHiddenPreviousPage = this.ClientID + ":" + HIDDENPREVIOUSPAGE;
else
{
this.strNoOfRecordsCheckBoxState = this.NamingContainer.ClientID + ":" + this.ID + ":" + HIDDENNORECORDSCHECKBOXSTATE;
this.strCheckBoxStateCount = this.NamingContainer.ClientID + ":" + this.ID + ":" + HIDDENCHECKBOXSTATECOUNT;
this.strHiddenPreviousPage = this.NamingContainer.ClientID + ":" + this.ID + ":" + HIDDENPREVIOUSPAGE;
//
//if(!object.Equals(HttpContext.Current.Session["DataSource"], null) && !object.Equals(HttpContext.Current.Session["DataMember"], null))
//{
//this.DataSource = HttpContext.Current.Session["DataSource"];
//this.DataMember = HttpContext.Current.Session["DataMember"].ToString();
//this.DataBind();
//}
/// <summary>
/// Method to handle the DataBinding event of the EMS Datagrid
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void EMSDataGrid_DataBinding(object sender, EventArgs e)
{
this.Columns.Clear();
//                                    
if (!this.IsTrackingViewState)
{
//if the page is loading for the first time, set the sort order to desc
if (this.ViewState["SortDirection"] == null)
{
this.ViewState["SortExpression"] = string.Empty;
//set the datasource
if (this.DataSource != null && this.DataSource is DataSet)
{
this.DataSource = ((DataSet)this.DataSource).Tables[this.DataMember.ToString()].DefaultView;
//
if (!(this.CurrentPageIndex <= (((DataView)this.DataSource).Table.Rows.Count / this.PageSize)))
{
//else
//{
//            this.CurrentPageIndex = 0;
//}
#region Set the Stylesheet styles
//Set the Stylesheet styles
//CAT
if (this.StyleSheet == StyleSheetType.CAT)
{
this.HeaderStyle.CssClass = "CATDataGridHeaderStyle"
this.ItemStyle.CssClass = "CATDataGridItemStyle"
this.AlternatingItemStyle.CssClass = "CATDataGridAlternatingStyle"
this.SelectedItemStyle.CssClass = "CATDataGridSelectedItemStyle"
this.FooterStyle.CssClass = "CATDataGridFooterStyle"
//Default
else if (this.StyleSheet == StyleSheetType.Default)
{
this.ItemStyle.CssClass = "DefaultDataGridItemStyle"
this.AlternatingItemStyle.CssClass = "DefaultDataGridAlternatingStyle"
this.HeaderStyle.CssClass = "DefaultDataGridHeaderStyle"
this.SelectedItemStyle.CssClass = "DefaultDataGridSelectedItemStyle"
#endregion
#region Adding Edit Item Template Column
//if the edit link is visible and edit on double click is enabled
//add the edit column
if (this.EditVisible || this.EditOnDoubleClick)
{
editCommandColumn.ButtonType = ButtonColumnType.LinkButton;
if (this.ControlCaption == CaptionType.Text)
{
editCommandColumn.UpdateText = "Apply"
editCommandColumn.CancelText = "Cancel"
else
{
editCommandColumn.ItemStyle.Font.Name = "wingdings 2"
editCommandColumn.EditText = "/"
editCommandColumn.UpdateText = "R"
editCommandColumn.CancelText = "T"
this.Columns.Add(editCommandColumn);
this.Columns[this.Columns.Count - 1].Visible = this.EditVisible;
#endregion
#region Adding Delete Item Template Column
//add the delete column
ButtonColumn deleteColumn = new ButtonColumn();
deleteColumn.CommandName = "delete"
if (this.ControlCaption == CaptionType.Text)
{
else
{
deleteColumn.ItemStyle.Font.Name = "webdings"
deleteColumn.Text = "r"
this.Columns.Add(deleteColumn);
this.Columns[this.Columns.Count - 1].Visible = this.DeleteVisible;
#endregion
//if the data source is not null, add the template column to each column
if (this.DataSource != null)
{
//HttpContext.Current.Session["DataSource"] = this.DataSource;
//HttpContext.Current.Session["DataMember"] = this.DataMember;
#region Adding ClientSide Script For SelectOnsingleClick etc...
string scriptString;
#region if the select on single click is true Set the OnClick Event of the grid
//if the select on single click is true Set the OnClick Event of the grid
if (this.SelectOnSingleClick)
{
scriptString = "<Script>"
scriptString += "var " + this.UniqueID.Replace(":", "_") + "SelectedItemIndex;"
scriptString += "var " + this.UniqueID.Replace(":", "_") + "SelectedItemStyle;"
if (this.DataSource != null && ((System.Data.DataView)this.DataSource).Table.Rows.Count > 0)
{
//                            //Code commented due to a bug, the bug still exists
if (this.KeyHiddenControlId != null && ((System.Web.UI.HtmlControls.HtmlInputHidden)this.Page.FindControl(this.KeyHiddenControlId)) != null)
{
if (this.AllowPaging && this.PagerStyle.Position == PagerPosition.TopAndBottom)
{
else
{
//this.Page.RegisterStartupScript(this.UniqueID.Replace(":","_") + "ScrolltoElement","<Script> document.getElementById(" + this.UniqueID.Replace(":","_") + "SelectedItemIndex).scrollIntoView(false); </Script>");
else
scriptString += " {"
scriptString += " try {"
scriptString += " if (" + this.UniqueID.Replace(":", "_") + "SelectedItemIndex != event.srcElement.parentElement.id && event.srcElement.parentElement.id!='')"
scriptString += " {"
//if(this.FullEditable) scriptString += "alert(" + this.UniqueID.Replace(":","_") + "SelectedItemIndex);"
//                      scriptString += "//Set Previously Selected Row to Alternating Style"
scriptString += " if (" + this.UniqueID.Replace(":", "_") + "SelectedItemIndex != '1')"
scriptString += " document.getElementById(" + this.UniqueID.Replace(":", "_") + "SelectedItemIndex).className=" + this.UniqueID.Replace(":", "_") + "SelectedItemStyle;"
//                      scriptString += "//Set Currently Selected Row to Selected Style"
scriptString += " " + this.UniqueID.Replace(":", "_") + "SelectedItemIndex = event.srcElement.parentElement.id;"
if (this.KeyHiddenControlId != null)
if (this.StyleSheet == StyleSheetType.CAT)
//enhanced for druv to allow checkbox click selection of row
scriptString += " if (" + this.UniqueID.Replace(":", "_") + "SelectedItemIndex != event.srcElement.parentElement.parentElement.id && event.srcElement.parentElement.parentElement.id!='')"
scriptString += " {"
//                      scriptString += "//Set Previously Selected Row to Alternating Style"
scriptString += " if (" + this.UniqueID.Replace(":", "_") + "SelectedItemIndex != '1')"
scriptString += " document.getElementById(" + this.UniqueID.Replace(":", "_") + "SelectedItemIndex).className=" + this.UniqueID.Replace(":", "_") + "SelectedItemStyle;"
//                      scriptString += "//Set Currently Selected Row to Selected Style"
scriptString += " " + this.UniqueID.Replace(":", "_") + "SelectedItemIndex = event.srcElement.parentElement.parentElement.id;"
if (this.KeyHiddenControlId != null)
//                                                                                                                                                
if (this.StyleSheet == StyleSheetType.CAT)
scriptString += "}"
scriptString += "catch (e) {}"
scriptString += "}"
scriptString += " </Script>"
//register the script
this.Page.RegisterClientScriptBlock(this.UniqueID.Replace(":", "_") + "SelectMe", scriptString);
#endregion
#region if the edit on double click is true, Set the doubleClick Event of the grid
//if the edit on double click is true, Set the doubleClick Event of the grid
if (this.EditOnDoubleClick && this.AllowEdit == EditType.UnAuthorized)
{
scriptString = "<Script>"
scriptString += " function " + this.UniqueID.Replace(":", "_") + "OpenMe()"
scriptString += " {"
scriptString += " }"
scriptString += " </Script>"
this.Page.RegisterClientScriptBlock(this.UniqueID.Replace(":", "_") + "OpenMe", scriptString);
if (this.EditOnDoubleClick && this.AllowEdit != EditType.UnAuthorized)
{
scriptString = "<Script>"
if (!this.SelectOnSingleClick)
scriptString += " {"
if (!this.SelectOnSingleClick)
scriptString += " var callEdit=new Function(document.getElementById(" + this.UniqueID.Replace(":", "_") + "SelectedItemIndex).onedit);"
scriptString += " callEdit();"
scriptString += " }}"
scriptString += " </Script>"
this.Page.RegisterClientScriptBlock(this.UniqueID.Replace(":", "_") + "OpenMe", scriptString);
#endregion
#region Call Delete Event of the Selected Item
//Call Delete Event of the Selected Item
scriptString = "<Script>"
scriptString += " function " + this.UniqueID.Replace(":", "_") + "DeleteMe()"
scriptString += " {"
scriptString += " var status=confirm('" + Resource.Application.DeleteConfirmationMessage + "');"
scriptString += " if (!status) return;"
scriptString += " if (" + this.UniqueID.Replace(":", "_") + "SelectedItemIndex != '1'){ "
scriptString += " var callDelete=new Function(document.getElementById(" + this.UniqueID.Replace(":", "_") + "SelectedItemIndex).onDelete);"
scriptString += " callDelete();"
scriptString += " } }"
scriptString += " </Script>"
this.Page.RegisterClientScriptBlock(this.UniqueID.Replace(":", "_") + "DeleteMe", scriptString);
#endregion
#endregion
//this.DataBind();
if (this.ViewState["SortExpression"].ToString().Length != 0)
/// <summary>
/// Gets Fired Each Time The DataGrid Is Processded
/// </summary>
/// <param name="e"></param>
protected override void OnItemCreated(DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Pager)
{
TableCell pager = (TableCell)e.Item.Controls[0];
pager.HorizontalAlign = HorizontalAlign.Left;
//Add Cell to Row to Hold Row Count Label
//                                                                TableCell newcell = new TableCell();
//                                                                newcell.HorizontalAlign = HorizontalAlign.Right;
//Add Label Indicating Row Count
Label lblNumRecords = new Label();
lblNumRecords.CssClass = "LabelStyle"
lblNumRecords.ID = "lblNumRecords"
pager.Controls.Add(lblNumRecords);
Table pagerTable = new Table();
pagerTable.Width = Unit.Percentage(100);
pagerTable.Rows.Add(new TableRow());
pagerTable.Rows[0].CssClass = e.Item.CssClass;
pagerTable.Rows[0].Cells.Add(pager);
//                                                                pagerTable.Rows[0].Cells.Add(newcell);
e.Item.Controls.Add(new TableCell());
((TableCell)e.Item.Controls[0]).ColumnSpan = pager.ColumnSpan;
e.Item.Controls[0].Controls.Add(pagerTable);
try
{
{
catch
{
}
/// <summary>
/// Method to handle the ItemDataBound event of the EMS Datagrid
/// </summary>
/// <param name="e"></param>
protected override void OnItemDataBound(DataGridItemEventArgs e)
{
//Set the Sort Glyph
if (e.Item.ItemType == ListItemType.Header && this.ViewState["SortExpression"] != null)
{
if (this.ViewState["SortExpression"].ToString().Length != 0)
{
{
{
lblSorted.Font.Name = "webdings"
lblSorted.Font.Size = FontUnit.XSmall;
if (this.ViewState["SortDirection"].ToString() == " ASC")
//only for items and alternating items
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
if (((DataRowView)e.Item.DataItem).DataView.Table.PrimaryKey.Length != 0)
e.Item.Attributes.Add("onclick", this.UniqueID.Replace(":", "_") + "SelectMe(); document.forms[0].item(\"" + this.strConcurrencyIdControl + "\").value='" + e.Item.Attributes["ID"] + "';");
{
//Set the tooltip if the captionstyle is graphics
if (this.ControlCaption == CaptionType.Graphics)
if (this.EditOnDoubleClick)
{
//this is to pass the selected item id as an argument to the event.
editbutton.CommandArgument = e.Item.Attributes["ID"];
e.Item.Attributes.Add("onedit", Page.GetPostBackClientHyperlink(editbutton, e.Item.Attributes["ID"]) + " document.forms[0].item(\"" + this.strConcurrencyIdControl + "\").value='" + e.Item.Attributes["ID"] + "';");
//                
if (this.DeleteVisible && this.AllowDelete == DeleteType.DeleteWithConfirmation && e.Item.Cells[1].Controls.Count > 0)
{
//
if (e.Item.Cells[1].Controls[0] is LinkButton)
{
else if (e.Item.Cells[0].Controls[0] is LinkButton)
{
//                                                                                                                                                                
if (!object.Equals(deletebutton, null))
{
if (this.ControlCaption == CaptionType.Graphics)
if (this.AllowDelete == DeleteType.DeleteWithConfirmation)
{
deletebutton.CommandArgument = e.Item.Attributes["ID"];
e.Item.Attributes.Add("onDelete", Page.GetPostBackClientHyperlink(deletebutton, e.Item.Attributes["ID"]) + " document.forms[0].item(\"" + this.strConcurrencyIdControl + "\").value='" + e.Item.Attributes["ID"] + "';");
try
{
if (this.editOnDoubleClick)
{
else
{
//this is to pass the selected item id as an argument to the event.
deletebutton.CommandArgument = e.Item.Attributes["ID"];
e.Item.Attributes.Add("onDelete", Page.GetPostBackClientHyperlink(deletebutton, e.Item.Attributes["ID"]) + " document.forms[0].item(\"" + this.strConcurrencyIdControl + "\").value='" + e.Item.Attributes["ID"] + "';");
catch
{
#endregion
#region From This Part Implements EMS 2.0 Written Yasin
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.EditItem)
{
{
DataTable dt = ((DataView)this.DataSource).Table;
//this.BindServerControl(e.Item, 0, e.Item.ItemIndex, dt.Rows[e.Item.ItemIndex], dt.Columns, dt.Columns.Count);
this.SetDropDownSelectedValue(e, 1);
//
this.SetRowColumnReadOnly(e.Item, 1, e.Item.ItemIndex, dt.Rows[e.Item.ItemIndex], dt.Columns, dt.Columns.Count);
//
this.AddValidatorControl(e, 1);
//
this.AddMultipleControls(e, 1);
//
this.AddDateControl(e, 1);
//
this.FormatGridCell(e, 1);
else if (this.EnhanceEdit)
{
{
DataTable dt = ((DataView)this.DataSource).Table;
//
this.BindServerControl(e.Item, 2, e.Item.ItemIndex, dt.Rows[e.Item.ItemIndex], dt.Columns, dt.Columns.Count);
//
this.AddValidatorControl(e, 2);
//
this.AddMultipleControls(e, 2);
//
this.AddDateControl(e, 2);
//Removing The Delete Button Link Incase of Edit Mode
if (e.Item.Cells[1].Controls[0] is LinkButton)
{
else
{
{
if (e.Item.ItemIndex < dt.Rows.Count)
{
this.FormatGridCell(e, 2);
else
{
//Adding The Feature Of CheckBoxState
if (this.blnCheckBoxState)
{
#endregion
base.OnItemDataBound(e);
/// <summary>
/// Get Fired to Before The HTML Content Is Rendered
/// </summary>
/// <param name="e"></param>
protected override void OnPreRender(EventArgs e)
{
{
int endRecord = (startRecord + this.PageSize) - 1;
if (((DataView)this.DataSource).Count < endRecord)
//Set the top pager
((Label)this.Controls[0].Controls[0].FindControl("lblNumRecords")).Text = "&nbsp;&nbsp;&nbsp;Records " + startRecord.ToString() + " to " + endRecord.ToString() + " of " + totalRecord.ToString();
//Clear the bottom pager
((Label)this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].FindControl("lblNumRecords")).Text = ""
//
if (((DataView)this.DataSource).Count == 0)
{
((Label)this.Controls[0].Controls[0].FindControl("lblNumRecords")).Text = "There are no records to be displayed."
this.Controls[0].Controls.Remove(this.Controls[0].Controls[1]);
this.Controls[0].Controls.Remove(this.Controls[0].Controls[2]);
this.Controls[0].Controls[0].Controls[0].Controls[0].Controls[0].Controls.Remove(this.Controls[0].Controls[0].Controls[0].Controls[0].Controls[0].Controls[0]);
this.BorderColor = Color.Transparent;
this.BorderStyle = BorderStyle.None;
//Adding The ClientSide Scripts For CheckBoxState
if (this.blnCheckBoxState)
{
//
if (this.Items.Count > 0)
{
this.hidConcurrencyIdControl.ID = HIDDENCONCURRENCYIDCONCTROL;
//
this.hidConcurrencyIdControl.Value = this.Items[0].Attributes["ID"];
//
this.Controls.Add(this.hidConcurrencyIdControl);
//Adding The Focus On The Editted Item Control
//                                    if(this.EnhanceEdit)
//                                    {
//                                                bool blnFocus = false;
//                                                for(int item = 0; item < this.Items.Count; item++)
//                                                {
//                                                            if(this.Items[item].ItemType == ListItemType.EditItem)
//                                                            {
//                                                                        for(int cell = 0; cell < this.Items[item].Cells.Count; cell++)            
//                                                                        {
//                                                                                    if(this.Items[item].Cells[cell].Visible)
//                                                                                    {
//                                                                                                for(int control = 0; control < this.Items[item].Cells[cell].Controls.Count; control++)
//                                                                                                {
//                                                                                                            if(this.Items[item].Cells[cell].Controls[control] is TextBox)
//                                                                                                            {
//                                                                                                                        if(!((TextBox)this.Items[item].Cells[cell].Controls[control]).ReadOnly)
//                                                                                                                        {
//                                                                                                                                    this.Page.RegisterClientScriptBlock("focus", "<script>document.forms[0].item(\"" + ((TextBox)this.Items[item].Cells[cell].Controls[control]).ClientID + "\").focus()</script>");
//                                                                                                                                    blnFocus = true;
//                                                                                                                                    break;
//                                                                                                                                                
//                                                                                                                        }
//                                                                                                            }
//                                                                                                            else if(this.Items[item].Cells[cell].Controls[control] is DropDownList)
//                                                                                                            {
//                                                                                                                        this.Page.RegisterClientScriptBlock("focus", "<script>document.forms[0].item(\"" + ((DropDownList)this.Items[item].Cells[cell].Controls[control]).ClientID + "\").focus()</script>");
//                                                                                                                        blnFocus = true;
//                                                                                                                        break;
//                                                                                                            }
//                                                                                                }
//                                                                                    }
//                                                                                    if(blnFocus) break;
//                                                                        }
//                                                            }
//                                                            if(blnFocus) break;
//                                                }
//                                    }                                    
base.OnPreRender(e);
/// <summary>
///
/// </summary>
/// <param name="savedState"></param>
//protected override void LoadViewState(object savedState)
//{
//this.DataSource = HttpContext.Current.Cache["temp"];
//this.DataMember = HttpContext.Current.Cache["temp1"].ToString();
//this.DataBind();
//TODO: Yasin, This is where the columns controls should be added - Amith Ellur
//}
//protected override object SaveViewState()
//{
//HttpContext.Current.Cache["temp"]  = this.DataSource;
//HttpContext.Current.Cache["temp1"] = this.DataMember;
//this.ViewState;
//        return null;
//}
#endregion
#region Events That Get Fired On Post Back When Edit, Delete, Sorting, Paging etc.. Get Fired
/// <summary>
/// Method to handle the PageIndexChanged event of the EMS Datagrid
/// </summary>
/// <param name="source"></param>
/// <param name="e"></param>
private void EMSDataGrid_PageIndexChanged(object source, DataGridPageChangedEventArgs e)
{
this.EditItemIndex = -1;
this.CurrentPageIndex = e.NewPageIndex;
this.DataBind();
/// <summary>
/// Method to handle the CancelCommand event of the EMS Datagrid
/// </summary>
/// <param name="source"></param>
/// <param name="e"></param>
private void EMSDataGrid_CancelCommand(object source, DataGridCommandEventArgs e)
{
this.DataBind();
/// <summary>
/// Method to handle the EditCommand event of the EMS Datagrid
/// </summary>
/// <param name="source"></param>
/// <param name="e"></param>
private void EMSDataGrid_EditCommand(object source, DataGridCommandEventArgs e)
{
{
this.ValidateConcurrencyControl(e.Item.Attributes["ID"]);
//if inline edit, hide the delete column
if (this.AllowEdit == EditType.InLine)
{
ToggleDeleteColumn(false);
this.DataBind();
//if not inline edit, then redirect to the selected page
else if (this.AllowEdit == EditType.PageRedirect)
{
catch (Exception exception)
{
/// <summary>
/// Method to handle the UpdateCommand event of the EMS Datagrid
/// </summary>
/// <param name="source"></param>
/// <param name="e"></param>
private void EMSDataGrid_UpdateCommand(object source, DataGridCommandEventArgs e)
{
if (this.EnhanceEdit)
{
this.ReadDataGridData(e.Item.ItemIndex);
//Creating A DataTable From The Default DataView
DataTable dt = ((DataView)this.DataSource).Table;
//Declaring the PK
DataColumn[] prk = dt.PrimaryKey;
//Coping the DataRow
DataRow dr = dt.Rows[e.Item.ItemIndex];
//Iterating Through the Primary Keys To Set The New Guid Incase A New Record Is Added
for (int dclength = 0; dclength < prk.Length; dclength++)
{
if (object.Equals(dr[prk[dclength].Ordinal], DBNull.Value))
{
if (dt.Columns[prk[dclength].ColumnName].ReadOnly)
{
dt.Columns[prk[dclength].ColumnName].ReadOnly = false;
dr[prk[dclength].ColumnName] = Guid.NewGuid();
dt.Columns[prk[dclength].ColumnName].ReadOnly = true;
//Iterating Through the DataColums To Set The Default Values For The New Data Row
for (int dclength = 0; dclength < dt.Columns.Count; dclength++)
{
if (dt.Columns[dclength].ReadOnly)
{
if (object.Equals(dr[dclength], DBNull.Value))
{
dt.Columns[dclength].ReadOnly = false;
dr[dclength] = dt.Columns[dclength].DefaultValue;
dt.Columns[dclength].ReadOnly = true;
//Copying the Structure of the datatable
this.dtModifiedDataTable = dt.Clone();
//Adding A new Row
DataRow newdr = this.dtModifiedDataTable.NewRow();
//Iterating To The Columns of the datarow
for (int i = 0; i < dr.ItemArray.Length; i++)
{
newdr[i] = dr.ItemArray[i];
//Adding The New DataRow
this.dtModifiedDataTable.Rows.Add(newdr);
//base.OnUpdateCommand(e);
//show the delete column of the datagrid
ToggleDeleteColumn(true);
/// <summary>
/// Method to handle the SortCommand event of the EMS Datagrid
/// </summary>
/// <param name="source"></param>
/// <param name="e"></param>
private void EMSDataGrid_SortCommand(object source, DataGridSortCommandEventArgs e)
{
//Change the sort direction for next use.
if (this.ViewState["SortDirection"].ToString() == " DESC")
// Sort property with the name of the field to sort by.
((DataView)this.DataSource).Sort = e.SortExpression + this.ViewState["SortDirection"];
// Rebind the data source and specify that it should be sorted
// by the field specified in the SortExpression property.
this.DataBind();
/// <summary>
///
/// </summary>
/// <param name="e"></param>
protected override void OnDeleteCommand(DataGridCommandEventArgs e)
{
{
if (this.Items.Count == 1)
this.ValidateConcurrencyControl(e.Item.Attributes["ID"]);
base.OnDeleteCommand(e);
catch (Exception exception)
{
this.ProcessException(exception);
/// <summary>
/// This Helper Function Rasies The EMSDataGridRaiseException Event
/// </summary>
/// <param name="exception"></param>
private void ProcessException(Exception exception)
{
if (!object.Equals(this.EMSDataGridRaiseException, null))
{
else
{
/// <summary>
/// Used For Page Redirect
/// </summary>
/// <param name="e"></param>
protected virtual void OnEditPage(DataGridCommandEventArgs e)
{
#endregion
#endregion
#region Helper Functions Used In Class
/// <summary>
/// Show/Hide the DELETE column when in edit mode. This handles the visibility of Delete column based on DeleteVisible property
/// </summary>
/// <param name="bViewState"></param>
private void ToggleDeleteColumn(bool bViewState)
{
/// <summary>
/// This Helper function Is Called In The Page Index Changed Event To Store The Checked Records In The Dataset From The Hidden Control
/// </summary>
/// <param name="?"></param>
/// <returns></returns>
private void WriteHiddenControl()
{
{
if (this.DataSource == null && this.DataSource is DataSet)
{
//
string strHidden = HttpContext.Current.Request[this.strHiddenCheckBoxState];
//Validating If The user has checked any records
if (strHidden.Length > 0)
{
if (object.Equals(this.ViewState[this.strHiddenCheckBoxState], null))
{
DataTable dtCheckBoxState = new DataTable(this.DataMember.ToString());
//Adding Columns To The DataTable
dtCheckBoxState.Columns.Add(new DataColumn("PageNumber", System.Type.GetType("System.Int64")));
dtCheckBoxState.Columns.Add(new DataColumn("Id", System.Type.GetType("System.Guid")));
//Splitting The Strings
string[] spliter = strHidden.Split(new char[1] { '~' });
string[] strId = spliter[1].Split(new char[1] { '^' });
//Adding The Newly Checked Records Into The DataTable
for (int i = 0; i < strId.Length; i++)
{
DataView dv = ((DataView)this.DataSource);
//
DataColumn[] dc = dv.Table.PrimaryKey;
//
if (dc.Length == 1)
{
DataRow[] DataRowSearch = dv.Table.Select(dc[0].ColumnName + "='" + strId[i] + "'");
//
if (DataRowSearch.Length == 1)
{
dtCheckBoxState.Rows.Add(drCheckBoxState);
drCheckBoxState["PageNumber"] = spliter[0];
drCheckBoxState["Id"] = strId[i];
else
{
//Creating the Instance Of The DataSet
this.dsCheckBoxState = new DataSet();
//Adding the DataTable To The DataSet
this.dsCheckBoxState.Tables.Add(dtCheckBoxState);
else
{
this.dsCheckBoxState = new DataSet();
//Creating The Instance of StringReader Class
StringReader sr = new StringReader(this.ViewState[this.strHiddenCheckBoxState].ToString());
//Loading The DataSet From StringReader Class
this.dsCheckBoxState.ReadXml(sr);
//Fetching The datatable from the dataset
DataTable dtCheckBoxState = this.dsCheckBoxState.Tables[this.DataMember.ToString()];
//Splitting The Strings
string[] spliter = strHidden.Split(new char[1] { '~' });
//Filtering The DataTable Based on DataRows
DataRow[] dr = dtCheckBoxState.Select("PageNumber" + "='" + strHidden[0] + "'");
//Removing The DataRows Which Were Affected From The DataTable.Select Method
for (int drCtr = 0; drCtr < dr.Length; drCtr++)
{
//                        
if (spliter.Length == 2)
{
string[] strId = spliter[1].Split(new char[1] { '^' });
//Checking The DataRow Length
if (dr.Length == 0)
{
for (int i = 0; i < strId.Length; i++)
{
DataView dv = ((DataView)this.DataSource);
//
DataColumn[] dc = dv.Table.PrimaryKey;
if (dc.Length == 1)
{
DataRow[] DataRowSearch = dv.Table.Select(dc[0].ColumnName + "='" + strId[i] + "'");
//
if (DataRowSearch.Length == 1)
{
dtCheckBoxState.Rows.Add(drCheckBoxState);
drCheckBoxState["PageNumber"] = spliter[0];
drCheckBoxState["Id"] = strId[i];
else
{
else
{
for (int i = 0; i < strId.Length; i++)
{
DataView dv = ((DataView)this.DataSource);
//
DataColumn[] dc = dv.Table.PrimaryKey;
if (dc.Length == 1)
{
DataRow[] DataRowSearch = dv.Table.Select(dc[0].ColumnName + "='" + strId[i] + "'");
//
if (DataRowSearch.Length == 1)
{
dtCheckBoxState.Rows.Add(drCheckBoxState);
drCheckBoxState["PageNumber"] = spliter[0];
drCheckBoxState["Id"] = strId[i];
else
{
//Storing The DataSet Into ViewState
//TODO: Amith Please Check This Option And Get Back
if (this.dsCheckBoxState.Tables[0].Rows.Count > 0)
{
this.intNoOfRecordsCheckBoxState = this.dsCheckBoxState.Tables[0].Rows.Count;
else
{
{
this.dsCheckBoxState = new DataSet();
//Creating The Instance of StringReader Class
StringReader sr = new StringReader(this.ViewState[this.strHiddenCheckBoxState].ToString());
//Loading The DataSet From StringReader Class
this.dsCheckBoxState.ReadXml(sr);
//Fetching The datatable from the dataset
DataTable dtCheckBoxState = this.dsCheckBoxState.Tables[this.DataMember.ToString()];
//Filtering The DataTable Based on DataRows
DataRow[] dr = dtCheckBoxState.Select("PageNumber" + "='" + HttpContext.Current.Request[this.strHiddenPreviousPage] + "'");
//Removing The DataRows Which Were Affected From The DataTable.Select Method
for (int drCtr = 0; drCtr < dr.Length; drCtr++)
{
//Storing The DataSet Into ViewState
//TODO: Amith Please Check This Option And Get Back
if (this.dsCheckBoxState.Tables[0].Rows.Count > 0)
{
else
{
//
if (!object.Equals(HttpContext.Current.Request[this.strCheckBoxStateCount], null))
{
if (HttpContext.Current.Request[this.strCheckBoxStateCount].Trim().Length > 0)
{
/// <summary>
/// Helper function Is used To Set The Various Item Template For The Grid
/// </summary>
private void SetColumnsCollection()
{
string strCellName;
int ctr;
//
if (this.EditOnDoubleClick && this.selectOnSingleClick)
{
else
{
//
foreach (DataColumn col in ((DataView)this.DataSource).Table.Columns)
{
this.PropertyCollection = col.ExtendedProperties;
TemplateColumn tc1 = new TemplateColumn();
if (this.intCheckBoxColumn == ctr)
{
else
{
tc1.ItemTemplate = new
if (!Object.Equals(col.ExtendedProperties[EMSDataGridExtendedProperties.Visibility], null))
{
this.Columns.Add(tc1);
//
ctr++;
/// <summary>
///  This Helper Function Is Used For Validating If The Selected Records Exists In Post Backs
/// </summary>
/// <param name="strID"></param>
private void ValidateConcurrencyControl(string strID)
{
{
{
/// <summary>
/// Helper Function Returns A DataTime Based On The Specific Format Used With Concurrency
/// </summary>
/// <param name="strDate"></param>
/// <returns></returns>
private DateTime DateConvertorConcurrency(string strDate)
{
return DateTime.ParseExact(strDate, "dd/MM/yyyy HH:mm:ss:fff", System.Globalization.CultureInfo.InvariantCulture, DateTimeStyles.None);
/// <summary>
/// Helper Function Returns A String Based On The Specific Format Used With Concurrency
/// </summary>
/// <param name="dtDate"></param>
/// <returns></returns>
private string DateConvertorConcurrency(DateTime dtDate)
{
/// <summary>
/// Helper function Is Used To Format The Date Based On System Preferences
/// </summary>
/// <param name="dtDate"></param>
/// <returns></returns>
public DateTime DateConvertor(string strDate)
{
return DateTime.ParseExact(strDate, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture, DateTimeStyles.None);
/// <summary>
///  Helper function Is Used To Format The Date Based On System Preferences
/// </summary>
/// <param name="dtDate"></param>
/// <returns></returns>
public string DateConvertor(DateTime dtDate)
{
/// <summary>
/// Helper function converts A DataRow Value into Date
/// </summary>
/// <param name="objDate"></param>
/// <returns></returns>
private object GetValidDate(object objDate)
{
{
else
{
/// <summary>
/// Helper function converts A DataRow Value into Valid String Value
/// </summary>
/// <param name="strValue"></param>
/// <returns></returns>
private object GetValidValue(string strValue)
{
if (strValue.Length == 0)
{
else
{
/// <summary>
/// Helper function converts A String Value Into A DataRow Value
/// </summary>
/// <param name="strControlValue"></param>
/// <returns></returns>
private object SetValidDBValue(string strControlValue)
{
if (strControlValue.Length == 0)
{
else
{
/// <summary>
/// This helper function is called in the ItemDataBound Event to format the Item Cells based on the datatypes
/// </summary>
private void FormatGridCell(DataGridItemEventArgs e, int cells)
{
{
for (int i = 0; i < dt.Columns.Count; i++)
{
switch (dt.Columns[i].DataType.ToString())
{
break;
break;
goto case "Numeric"
goto case "Numeric"
goto case "Numeric"
goto case "Numeric"
goto case "Numeric"
goto case "Numeric"
e.Item.Cells[cells].HorizontalAlign = HorizontalAlign.Center;
//Format Based
for (int ctl = 0; ctl < e.Item.Cells[cells].Controls.Count; ctl++)
{
{
{
break;
else if (e.Item.Cells[cells].Controls[ctl] is TextBox)
{
{
break;
break;
break;
cells++;
catch
{
}
/// <summary>
/// Helper Functions Used to Various Validator Control
/// </summary>
/// <param name="e"></param>
/// <param name="cells"></param>
private void AddValidatorControl(DataGridItemEventArgs e, int cells)
{
for (int i = 0; i < dt.Columns.Count; i++)
{
//Putting Required Field Validators For Colunms
if (!dt.Columns[i].ReadOnly && !dt.Columns[i].AllowDBNull)
{
{
{
e.Item.Cells[cells].Controls.Add(RequiredFieldValidatorControl(strCellName));
if (e.Item.Cells[cells].Controls[ctl] is DropDownList)
{
e.Item.Cells[cells].Controls.Add(RequiredFieldValidatorControl(strCellName));
//Putting The Range Validator To Handle Arthi OverFlow Error
switch (dt.Columns[i].DataType.ToString())
{
{
{
{
e.Item.Cells[cells].Controls.Add(this.RangeValidatorControl(strCellName, ValidationDataType.Double, dt.Columns[i].ExtendedProperties[EMSDataGridExtendedProperties.MaxValue], dt.Columns[i].ExtendedProperties[EMSDataGridExtendedProperties.MinValue]));
break;
//Adding Additional Required Field Validator Controls
if (!object.Equals(dt.Columns[i].ExtendedProperties[EMSDataGridExtendedProperties.CustomRequiredFieldValidator], null))
{
if (!object.Equals(dt.Columns[i].ExtendedProperties[EMSDataGridExtendedProperties.CustomRequiredFieldValidatorErrorMessage], null))
{
else
{
if (!object.Equals(dt.Columns[i].ExtendedProperties[EMSDataGridExtendedProperties.CustomRequiredFieldValidatorCssClass], null))
{
else
{
for (int ctl = 0; ctl < e.Item.Cells[cells].Controls.Count; ctl++)
{
{
else if (e.Item.Cells[cells].Controls[ctl] is DropDownList)
{
rfv.ControlToValidate = strCellName;
e.Item.Cells[cells].Controls.Add(rfv);
//Adding Additional Regular Expression Validator Controls
if (!object.Equals(dt.Columns[i].ExtendedProperties[EMSDataGridExtendedProperties.CustomRegularExpressionValidator], null))
{
if (!object.Equals(dt.Columns[i].ExtendedProperties[EMSDataGridExtendedProperties.CustomRegularExpressionValidatorErrorMessage], null))
{
else
{
if (!object.Equals(dt.Columns[i].ExtendedProperties[EMSDataGridExtendedProperties.CustomRegularExpressionValidatorCssClass], null))
{
else
{
if (!object.Equals(dt.Columns[i].ExtendedProperties[EMSDataGridExtendedProperties.CustomRegularExpressionValidatorExpression], null))
{
else
{
for (int ctl = 0; ctl < e.Item.Cells[cells].Controls.Count; ctl++)
{
{
else if (e.Item.Cells[cells].Controls[ctl] is DropDownList)
{
rev.ControlToValidate = strCellName;
e.Item.Cells[cells].Controls.Add(rev);
//Adding Additional Custom Validator Controls
if (!object.Equals(dt.Columns[i].ExtendedProperties[EMSDataGridExtendedProperties.CustomCustomValidator], null))
{
if (!object.Equals(dt.Columns[i].ExtendedProperties[EMSDataGridExtendedProperties.CustomCustomValidatorErrorMessage], null))
{
else
{
if (!object.Equals(dt.Columns[i].ExtendedProperties[EMSDataGridExtendedProperties.CustomCustomValidatorCssClass], null))
{
else
{
if (!object.Equals(dt.Columns[i].ExtendedProperties[EMSDataGridExtendedProperties.CustomCustomValidatorClientValidationFunction], null))
{
else
{
for (int ctl = 0; ctl < e.Item.Cells[cells].Controls.Count; ctl++)
{
{
else if (e.Item.Cells[cells].Controls[ctl] is DropDownList)
{
cv.ControlToValidate = strCellName;
e.Item.Cells[cells].Controls.Add(cv);
//Range Validator
//Compare Validator
cells++;
/// <summary>
/// Helper Function Used To Add Multiple Controls
/// </summary>
/// <param name="e"></param>
/// <param name="cells"></param>
private void AddMultipleControls(DataGridItemEventArgs e, int cells)
{
for (int i = 0; i < dt.Columns.Count; i++)
{
//Putting The Range Validator To Handle Arthi OverFlow Error
switch (dt.Columns[i].DataType.ToString())
{
{
for (int ctl = 0; ctl < e.Item.Cells[cells].Controls.Count; ctl++)
{
{
{
//Storing The Textbox Information In ElipseTextBox
textbox = ((TextBox)e.Item.Cells[cells].Controls[ctl]);
else if (e.Item.Cells[cells].Controls[ctl] is HtmlInputButton && !object.Equals(textbox, null))
{
else if (!object.Equals(dt.Columns[i].ExtendedProperties[EMSDataGridExtendedProperties.MultipleControl], null))
{
object[] obj = (object[])dt.Columns[i].ExtendedProperties[EMSDataGridExtendedProperties.MultipleControl];
//
string strControlValue = string.Empty;
//
if (e.Item.Cells[cells].Controls[0] is TextBox)
{
else if (e.Item.Cells[cells].Controls[0] is Literal)
{
//
string[] spliter = strControlValue.Split(new char[1] { char.Parse(dt.Columns[i].ExtendedProperties[EMSDataGridExtendedProperties.MultipleControlDelimiter].ToString()) });
//
e.Item.Cells[cells].Controls.RemoveAt(0);
//
for (int ctr = 0; ctr < obj.Length; ctr++)
{
if (hashtable[EMSDataGridExtendedProperties.MultipleControlDropDown] is DropDownList)
{
if (this.FullEditable)
{
dropdownlist = new DropDownList();
else
{
dropdownlist.CssClass = DROPDOWNSTYLE;
if (object.Equals(dropdownlist.ID, null))
{
DataTable datatable = (DataTable)hashtable[EMSDataGridExtendedProperties.MultipleControlDropDownDataTable];
dropdownlist.DataSource = datatable;
dropdownlist.DataTextField = hashtable[EMSDataGridExtendedProperties.MultipleControlDropDownDataTextField].ToString();
dropdownlist.DataValueField = hashtable[EMSDataGridExtendedProperties.MultipleControlDropDownDataValueField].ToString();
dropdownlist.DataBind();
dropdownlist.Items[0].Text = DROPDOWNDEFAULTTEXT;
if (spliter.Length == obj.Length)
{
{
if (this.FullEditable)
{
{
{
if (!blnFlag)
{
if (!object.Equals(hashtable[EMSDataGridExtendedProperties.MultipleControlRequiredFieldValidator], null))
{
if (this.FullEditable)
{
else
{
rfv.ErrorMessage = REQUIREDERRORMESSAGE + "<BR>"
rfv.CssClass = VALIDATORSTYLESHEET;
rfv.ControlToValidate = dropdownlist.ID;
rfv.Display = ValidatorDisplay.Dynamic;
e.Item.Cells[cells].Controls.Add(rfv);
if (!object.Equals(hashtable[EMSDataGridExtendedProperties.MultipleControlCompareValidator], null))
{
if (this.FullEditable)
{
else
{
cv.CssClass = VALIDATORSTYLESHEET;
cv.Display = ValidatorDisplay.Dynamic;
e.Item.Cells[cells].Controls.Add(cv);
if (!object.Equals(hashtable[EMSDataGridExtendedProperties.MultipleControlCustomValidator], null))
{
if (this.FullEditable)
{
else
{
cv.CssClass = VALIDATORSTYLESHEET;
cv.Display = ValidatorDisplay.Dynamic;
e.Item.Cells[cells].Controls.Add(cv);
if (!object.Equals(hashtable[EMSDataGridExtendedProperties.MultipleControlRangeValidator], null))
{
if (this.FullEditable)
{
else
{
rv.CssClass = VALIDATORSTYLESHEET;
rv.Display = ValidatorDisplay.Dynamic;
e.Item.Cells[cells].Controls.Add(rv);
if (!object.Equals(hashtable[EMSDataGridExtendedProperties.MultipleControlRegularExpressionValidator], null))
{
if (this.FullEditable)
{
else
{
re.CssClass = VALIDATORSTYLESHEET;
re.Display = ValidatorDisplay.Dynamic;
e.Item.Cells[cells].Controls.Add(re);
else
{
else
{
if (!object.Equals(hashtable[EMSDataGridExtendedProperties.MultipleControlRequiredFieldValidator], null))
{
if (this.FullEditable)
{
else
{
rfv.ErrorMessage = REQUIREDERRORMESSAGE + "<BR>"
rfv.CssClass = VALIDATORSTYLESHEET;
rfv.ControlToValidate = dropdownlist.ID;
rfv.Display = ValidatorDisplay.Dynamic;
e.Item.Cells[cells].Controls.Add(rfv);
if (!object.Equals(hashtable[EMSDataGridExtendedProperties.MultipleControlCompareValidator], null))
{
if (this.FullEditable)
{
else
{
cv.CssClass = VALIDATORSTYLESHEET;
cv.Display = ValidatorDisplay.Dynamic;
e.Item.Cells[cells].Controls.Add(cv);
if (!object.Equals(hashtable[EMSDataGridExtendedProperties.MultipleControlCustomValidator], null))
{
if (this.FullEditable)
{
else
{
cv.CssClass = VALIDATORSTYLESHEET;
cv.Display = ValidatorDisplay.Dynamic;
e.Item.Cells[cells].Controls.Add(cv);
if (!object.Equals(hashtable[EMSDataGridExtendedProperties.MultipleControlRangeValidator], null))
{
if (this.FullEditable)
{
else
{
//RangeValidator rv = (RangeValidator)hashtable[EMSDataGridExtendedProperties.MultipleControlRangeValidator];
rv.CssClass = VALIDATORSTYLESHEET;
rv.Display = ValidatorDisplay.Dynamic;
e.Item.Cells[cells].Controls.Add(rv);
if (!object.Equals(hashtable[EMSDataGridExtendedProperties.MultipleControlRegularExpressionValidator], null))
{
if (this.FullEditable)
{
else
{
re.CssClass = VALIDATORSTYLESHEET;
re.Display = ValidatorDisplay.Dynamic;
e.Item.Cells[cells].Controls.Add(re);
else
{
if (!object.Equals(hashtable[EMSDataGridExtendedProperties.MultipleControlRequiredFieldValidator], null))
{
rfv.ErrorMessage = REQUIREDERRORMESSAGE + "<BR>"
rfv.CssClass = VALIDATORSTYLESHEET;
rfv.ControlToValidate = dropdownlist.ID;
rfv.Display = ValidatorDisplay.Dynamic;
e.Item.Cells[cells].Controls.Add(rfv);
if (!object.Equals(hashtable[EMSDataGridExtendedProperties.MultipleControlCompareValidator], null))
{
cv.CssClass = VALIDATORSTYLESHEET;
cv.Display = ValidatorDisplay.Dynamic;
e.Item.Cells[cells].Controls.Add(cv);
if (!object.Equals(hashtable[EMSDataGridExtendedProperties.MultipleControlCustomValidator], null))
{
cv.CssClass = VALIDATORSTYLESHEET;
cv.Display = ValidatorDisplay.Dynamic;
e.Item.Cells[cells].Controls.Add(cv);
if (!object.Equals(hashtable[EMSDataGridExtendedProperties.MultipleControlRangeValidator], null))
{
rv.CssClass = VALIDATORSTYLESHEET;
rv.Display = ValidatorDisplay.Dynamic;
e.Item.Cells[cells].Controls.Add(rv);
if (!object.Equals(hashtable[EMSDataGridExtendedProperties.MultipleControlRegularExpressionValidator], null))
{
re.CssClass = VALIDATORSTYLESHEET;
re.Display = ValidatorDisplay.Dynamic;
e.Item.Cells[cells].Controls.Add(re);
break;
cells++;
/// <summary>
/// Helper Function Used To Set The Values For Editable Grid Items
/// </summary>
/// <param name="e"></param>
/// <param name="cells"></param>
/// <param name="row"></param>
/// <param name="dr"></param>
/// <param name="dc"></param>
/// <param name="columncount"></param>
private void BindServerControl(DataGridItem e, int cells, int row, DataRow dr, DataColumnCollection dc, int columncount)
{
DataTable dt = ((DataView)this.DataSource).Table;
//
DataColumn[] dcPrimaryKey;
//
dcPrimaryKey = dt.PrimaryKey;
#region Making The Whole Row As ReadOnly
if (dcPrimaryKey.Length == 1)
{
{
if (dr[dcPrimaryKey[0].ExtendedProperties[EMSDataGridExtendedProperties.ReadOnlyRow].ToString()].GetType().ToString() == "System.Boolean")
{
if ((bool)dr[dcPrimaryKey[0].ExtendedProperties[EMSDataGridExtendedProperties.ReadOnlyRow].ToString()])
{
if (!Object.Equals(dcPrimaryKey[0].ExtendedProperties[EMSDataGridExtendedProperties.ReadOnlyStyle], null))
{
else
{
//
if (e.Cells[0].Controls[0] is LinkButton)
{
//
if (e.Cells[1].Controls[0] is LinkButton)
{
#endregion
//
for (int i = 0; i < columncount; i++)
{
{
//Putting The Range Validator To Handle Arthi OverFlow Error
switch (dc[i].DataType.ToString())
{
case ("System.Guid"):
{
{
if (e.Cells[cells].Controls[0] is Literal)
{
break;
else if (e.Cells[cells].Controls[ctl] is Literal)
{
break;
#region Setting TextBox Value with Decimal DataType
case ("System.Decimal"):
{
{
break;
break;
case ("System.Int16"):
case ("System.DateTime"):
{
{
{
{
this.ViewState["ItemIndex"] = e.ItemIndex;
else if (this.ViewState[HIDDENCONCURRENCYSTATE].ToString().Trim().Length > 0 && (int)this.ViewState["ItemIndex"] != e.ItemIndex)
{
{
this.ViewState["ItemIndex"] = e.ItemIndex;
break;
#endregion
#region Setting A Particular Column As ReadOnly In EnLine Edit
//
if (!object.Equals(dc[i].ExtendedProperties[EMSDataGridExtendedProperties.ReadOnly], null))
{
//
if (dc[i].ExtendedProperties[EMSDataGridExtendedProperties.ReadOnly].GetType().ToString() == "System.Boolean")
{
{
if (e.Cells[cells].Controls[ctl] is TextBox)
{
if ((bool)dc[i].ExtendedProperties[EMSDataGridExtendedProperties.ReadOnly])
{
e.Cells[cells].Controls.Add(lit);
e.Cells[cells].Controls.Remove(e.Cells[cells].Controls[ctl]);
break;
//
if (e.Cells[cells].Controls[ctl] is DropDownList)
{
if ((bool)dc[i].ExtendedProperties[EMSDataGridExtendedProperties.ReadOnly])
{
e.Cells[cells].Controls.Add(lit);
e.Cells[cells].Controls.Remove(e.Cells[cells].Controls[ctl]);
break;
//
else if (dr[dc[i].ExtendedProperties[EMSDataGridExtendedProperties.ReadOnly].ToString()].GetType().ToString() == "System.Boolean")
{
for (int ctl = 0; ctl < e.Cells[cells].Controls.Count; ctl++)
{
if (e.Cells[cells].Controls[ctl] is TextBox)
{
if ((bool)dr[dc[i].ExtendedProperties[EMSDataGridExtendedProperties.ReadOnly].ToString()])
{
e.Cells[cells].Controls.Add(lit);
e.Cells[cells].Controls.Remove(e.Cells[cells].Controls[ctl]);
break;
//
if (e.Cells[cells].Controls[ctl] is DropDownList)
{
if ((bool)dr[dc[i].ExtendedProperties[EMSDataGridExtendedProperties.ReadOnly].ToString()])
{
e.Cells[cells].Controls.Add(lit);
e.Cells[cells].Controls.Remove(e.Cells[cells].Controls[ctl]);
break;
#endregion
cells++;
/// <summary>
/// Helper function Used To Make A Row or Column ReadOnly
/// </summary>
/// <param name="e"></param>
/// <param name="cells"></param>
/// <param name="row"></param>
/// <param name="dr"></param>
/// <param name="dc"></param>
/// <param name="columncount"></param>
private void SetRowColumnReadOnly(DataGridItem e, int cells, int row, DataRow dr, DataColumnCollection dc, int columncount)
{
DataTable dt = ((DataView)this.DataSource).Table;
//
DataColumn[] dcPrimaryKey;
//
dcPrimaryKey = dt.PrimaryKey;
#region Making The Whole Row As ReadOnly
if (dcPrimaryKey.Length == 1)
{
{
if (dr[dcPrimaryKey[0].ExtendedProperties[EMSDataGridExtendedProperties.ReadOnlyRow].ToString()].GetType().ToString() == "System.Boolean")
{
if ((bool)dr[dcPrimaryKey[0].ExtendedProperties[EMSDataGridExtendedProperties.ReadOnlyRow].ToString()])
{
if (!Object.Equals(dcPrimaryKey[0].ExtendedProperties[EMSDataGridExtendedProperties.ReadOnlyStyle], null))
{
else
{
//
foreach (TableCell tc in e.Cells)
{
{
{
Literal lit = new Literal();
lit.Text = ((TextBox)control).Text;
tc.Controls.Remove(control);
tc.Controls.Add(lit);
else if (control is DropDownList)
{
Literal lit = new Literal();
lit.Text = ((DropDownList)control).SelectedItem.Text;
tc.Controls.Remove(control);
tc.Controls.Add(lit);
else if (control is CheckBox)
{
#endregion
//
for (int i = 0; i < columncount; i++)
{
{
//
if (!object.Equals(dc[i].ExtendedProperties[EMSDataGridExtendedProperties.ReadOnly], null))
{
{
{
if (e.Cells[cells].Controls[ctl] is TextBox)
{
if ((bool)dc[i].ExtendedProperties[EMSDataGridExtendedProperties.ReadOnly])
{
//                                                                                                                                                                                                                                                                                                                                                                                                                                                        
lit.Text = ((TextBox)e.Cells[cells].Controls[ctl]).Text;
e.Cells[cells].Controls.Add(lit);
e.Cells[cells].Controls.Remove(e.Cells[cells].Controls[ctl]);
break;
//
if (e.Cells[cells].Controls[ctl] is DropDownList)
{
if ((bool)dc[i].ExtendedProperties[EMSDataGridExtendedProperties.ReadOnly])
{
//
lit.Text = ((DropDownList)e.Cells[cells].Controls[ctl]).SelectedItem.Text;
e.Cells[cells].Controls.Add(lit);
e.Cells[cells].Controls.Remove(e.Cells[cells].Controls[ctl]);
break;
//
if (e.Cells[cells].Controls[ctl] is CheckBox)
{
break;
//
else if (dr[dc[i].ExtendedProperties[EMSDataGridExtendedProperties.ReadOnly].ToString()].GetType().ToString() == "System.Boolean")
{
for (int ctl = 0; ctl < e.Cells[cells].Controls.Count; ctl++)
{
if (e.Cells[cells].Controls[ctl] is TextBox)
{
if ((bool)dr[dc[i].ExtendedProperties[EMSDataGridExtendedProperties.ReadOnly].ToString()])
{
//
lit.Text = ((TextBox)e.Cells[cells].Controls[ctl]).Text;
e.Cells[cells].Controls.Add(lit);
e.Cells[cells].Controls.Remove(e.Cells[cells].Controls[ctl]);
break;
//
if (e.Cells[cells].Controls[ctl] is DropDownList)
{
if ((bool)dr[dc[i].ExtendedProperties[EMSDataGridExtendedProperties.ReadOnly].ToString()])
{
//
lit.Text = ((DropDownList)e.Cells[cells].Controls[ctl]).SelectedItem.Text;
e.Cells[cells].Controls.Add(lit);
e.Cells[cells].Controls.Remove(e.Cells[cells].Controls[ctl]);
break;
if (e.Cells[cells].Controls[ctl] is CheckBox)
{
break;
#endregion
cells++;
/// <summary>
/// Helper function Used To Set The Selected Value Of The Added DropDown Box
/// </summary>
/// <param name="e"></param>
/// <param name="cells"></param>
private void SetDropDownSelectedValue(DataGridItemEventArgs e, int cells)
{
string strLiteralText = null;
int intRemove = -1;
for (int i = 0; i < dt.Columns.Count; i++)
{
{
switch (dt.Columns[i].DataType.ToString())
{
{
{
intRemove = ctl;
if (e.Item.Cells[cells].Controls[ctl] is DropDownList)
{
{
if (intRemove > -1)
{
intRemove = -1;
break;
cells++;
/// <summary>
/// Helper Function Used To Add Required Field Validator Control
/// </summary>
/// <param name="ID"></param>
/// <returns></returns>
private RequiredFieldValidator RequiredFieldValidatorControl(string ID)
{
rfv.CssClass = VALIDATORSTYLESHEET;
rfv.Display = ValidatorDisplay.Dynamic;
rfv.ControlToValidate = ID;
if (!object.Equals(this.PropertyCollection[EMSDataGridExtendedProperties.RequiredErrorMessage], null))
{
else
{
return rfv;
/// <summary>
/// Helper Function Used Add The Range Validator Control
/// </summary>
/// <param name="ID"></param>
/// <param name="ValDataType"></param>
/// <param name="MaxValue"></param>
/// <param name="MinValue"></param>
/// <returns></returns>
private RangeValidator RangeValidatorControl(string ID, ValidationDataType ValDataType, object MaxValue, object MinValue)
{
rv.CssClass = VALIDATORSTYLESHEET;
rv.Display = ValidatorDisplay.Dynamic;
rv.Type = ValDataType;
rv.ControlToValidate = ID;
if (!Object.Equals(MaxValue, null))
{
else
{
if (!Object.Equals(MinValue, null))
{
else
{
if (!Object.Equals(PropertyCollection[EMSDataGridExtendedProperties.RequiredErrorMessage], null))
{
else
{
return rv;
/// <summary>
/// Helper Function To Populate The Drop Down Box
/// </summary>
/// <param name="ddl"></param>
/// <param name="strDefaultData"></param>
/// <param name="columnname"></param>
/// <param name="columncaption"></param>
/// <param name="PropertyCollection"></param>
private void BindDropDown(DropDownList ddl, string strDefaultData, string columnname, string columncaption, System.Data.PropertyCollection PropertyCollection)
{
if (!object.Equals(PropertyCollection[EMSDataGridExtendedProperties.DataTable], null))
{
if (!object.Equals(dt.Rows[0][0], DBNull.Value))
{
dr[0] = DBNull.Value;
dr[1] = DROPDOWNDEFAULTTEXT;
dt.Rows.InsertAt(dr, 0);
ddl.DataSource = dt;
if (!object.Equals(PropertyCollection[EMSDataGridExtendedProperties.DataValueField], null))
{
else
{
if (!object.Equals(PropertyCollection[EMSDataGridExtendedProperties.DataTextField], null))
{
else
{
ddl.DataBind();
ddl.CssClass = DROPDOWNSTYLE;
ddl.SelectedValue = strDefaultData;
else
{
/// <summary>
/// Reads The Data From The DataItem And updates the bounded datasource
/// </summary>
public void EMSDataGridReadData()
{
this.ReadDataGridData(this.EditItemIndex);
/// <summary>
/// Reads The Data From The DataItem And updates the bounded datasource
/// </summary>
/// <param name="row"></param>
private void ReadDataGridData(int row)
{
//Update The DataSource With Latest Information
DataTable dt = ((DataView)this.DataSource).Table;
int Cell, BaseCell;
int Item;
if (object.Equals(dt, null)) return;
if (row == -1)
{
BaseCell = 1;
Cell = BaseCell;
Item = 0;
else
{
Cell = BaseCell;
Item = row;
//foreach(DataGridItem datagridItem in this.Items)
for (; Item < this.Items.Count; Item++)
{
row++;
for (int col = 0; col < dt.Columns.Count; col++)
{
{
{
{
{
{
if (!dt.Columns[col].AllowDBNull && object.Equals(DBValue, DBNull.Value))
{
else
{
break;
break;
{
for (int ctl = 0; ctl < this.Items[Item].Cells[Cell].Controls.Count; ctl++)
{
{
else if (this.Items[Item].Cells[Cell].Controls[ctl] is Literal)
{
else if (this.Items[Item].Cells[Cell].Controls[ctl] is DropDownList)
{
else
{
if (!dt.Columns[col].AllowDBNull && object.Equals(DBValue, DBNull.Value))
{
else
{
{
{
{
else
{
else
{
break;
if (!object.Equals(dt.Columns[col].ExtendedProperties[EMSDataGridExtendedProperties.MultipleControl], null))
{
break;
{
{
{
break;
{
{
{
if (!dt.Columns[col].AllowDBNull && object.Equals(DBValue, DBNull.Value))
{
else
{
break;
{
{
{
if (!dt.Columns[col].AllowDBNull && object.Equals(DBValue, DBNull.Value))
{
else
{
break;
{
{
{
if (!dt.Columns[col].AllowDBNull && object.Equals(DBValue, DBNull.Value))
{
else
{
break;
{
{
{
if (!dt.Columns[col].AllowDBNull && object.Equals(DBValue, DBNull.Value))
{
else
{
break;
{
{
{
if (!dt.Columns[col].AllowDBNull && object.Equals(DBValue, DBNull.Value))
{
else
{
break;
{
{
{
if (!dt.Columns[col].AllowDBNull && object.Equals(DBValue, DBNull.Value))
{
else
{
break;
{
{
this.ViewState[HIDDENCONCURRENCYSTATE] = null;
else
{
{
{
{
//DBValue = SetValidDBValue(((TextBox)this.Items[Item].Cells[Cell].Controls[ctl]).Text);
if (!dt.Columns[col].AllowDBNull && object.Equals(DBValue, DBNull.Value))
{
else
{
break;
//Incrementing The Cell
if (this.EditItemIndex == -1)
{
{
else
{
else
{
if (this.EditItemIndex != -1)
{
/// <summary>
/// Adds The DataControl For The DataItem If The DataType Is DataTime
/// </summary>
/// <param name="e"></param>
/// <param name="cells"></param>
private void AddDateControl(DataGridItemEventArgs e, int cells)
{
for (int i = 0; i < dt.Columns.Count; i++)
{
//Putting The Range Validator To Handle Arthi OverFlow Error
switch (dt.Columns[i].DataType.ToString())
{
for (int ctl = 0; ctl < e.Item.Cells[cells].Controls.Count; ctl++)
{
{
{
//Storing The Textbox Information In ElipseTextBox
textbox = ((TextBox)e.Item.Cells[cells].Controls[ctl]);
if (!object.Equals(textbox, null))
{
Literal literal = new Literal();
literal.Text = "&nbsp;"
e.Item.Cells[cells].Controls.Add(literal);
ImageButton ibtnCalendarStartDate = new ImageButton();
ibtnCalendarStartDate.ImageUrl = this.ResolveUrl(System.Configuration.ConfigurationSettings.AppSettings["CalenderImage"]);
ibtnCalendarStartDate.Attributes.Add("onclick", "getCalendar(document.forms[0].item(\"" + textbox.ClientID + "\"), '" + this.ResolveUrl(System.Configuration.ConfigurationSettings.AppSettings["CalenderControl"]) + "'); return false;");
e.Item.Cells[cells].Controls.Add(ibtnCalendarStartDate);
else if (e.Item.Cells[cells].Controls[ctl] is HtmlInputButton && !object.Equals(textbox, null))
{
break;
cells++;
/// <summary>
/// Adds The Functionality for Each DataItem To Maintain The checkbox state across pages
/// </summary>
/// <param name="e"></param>
private void AddCheckBoxState(DataGridItemEventArgs e)
{
int intCurrentPageRowCount = 0;
string strCheckBoxState = string.Empty;
string strCheckBoxStateCount = string.Empty;
HtmlInputHidden hidCheckBoxState = new HtmlInputHidden();
//                                                
//This Part of Code Is Used For Mainting Checkbox State Across Pages                                    
if (this.blnCheckBoxState)
{
{
this.dsCheckBoxState = new DataSet();
//Creating The Instance of StringReader Class
StringReader sr = new StringReader(this.ViewState[this.strHiddenCheckBoxState].ToString());
//Loading The DataSet From StringReader Class
this.dsCheckBoxState.ReadXml(sr);
//
switch (e.Item.ItemType)
{
CheckBox chkHeader = (CheckBox)e.Item.Cells[this.intCheckBoxColumn].Controls[0];
//
//chkHeader.ID = this.ID + e.Item.ItemIndex + e.Item.Cells[this.intCheckBoxColumn];
//
chkHeader.Attributes.Add("onclick", "EMSGridCheckAll(document.all." + this.ClientID + ", document.forms[0]." + chkHeader.ClientID + ");EMSGridCheckboxState(document.all." + this.ClientID + ", " + this.CurrentPageIndex + ", '" + this.strHiddenCheckBoxState + "', '" + this.strNoOfRecordsCheckBoxState + "', '" + this.strCheckBoxStateCount + "', document.forms[0].item(\"" + chkHeader.ClientID + "\")," + this.PageSize + ",'" + this.strHiddenPreviousPage + "');");
//
strHeaderCheckBoxId = chkHeader.ClientID;
if (!this.blnClearGridStatus)
{
//Make The Previous Pages Checkbox Checked If Records Exists For Them
if (!object.Equals(this.dsCheckBoxState, null))
{
if (this.dsCheckBoxState.Tables.Count == 1)
{
if (this.dsCheckBoxState.Tables[0].Rows.Count > 0)
{
//                                        
if ((dr.Length) == this.PageSize)
{
else
{
//
if (!object.Equals(HttpContext.Current.Request[this.strNoOfRecordsCheckBoxState], null))
{
{
{
{
DataRow[] dr = dsCheckBoxState.Tables[0].Select("PageNumber" + "='" + this.CurrentPageIndex + "'");
//                                                                                                                                                                                                                                                                                                                                                                                                                                                        
intCurrentPageRowCount = dr.Length;
//
strCheckBoxState = intCurrentPageRowCount.ToString();
//
if (!object.Equals(this.dsCheckBoxState, null))
{
{
{
{
intRowCount = this.dsCheckBoxState.Tables[0].Rows.Count - intCurrentPageRowCount;
//
strCheckBoxStateCount = intRowCount.ToString();
//Adding The Hidden Control To The Page
HtmlInputHidden hid = new HtmlInputHidden();
hid.ID = HIDDENCHECKSTATE;
//
this.Controls.Add(hid);
//Adding The Hidden Control To The Page
hidCheckBoxState.ID = HIDDENNORECORDSCHECKBOXSTATE;
hidCheckBoxState.Value = strCheckBoxState;
//
this.Controls.Add(hidCheckBoxState);
//Adding the Hidden Control to The page
HtmlInputHidden hidCheckBoxStateCount = new HtmlInputHidden();
hidCheckBoxStateCount.ID = HIDDENCHECKBOXSTATECOUNT;
hidCheckBoxStateCount.Value = strCheckBoxStateCount;
//
this.Controls.Add(hidCheckBoxStateCount);
//
//this.Controls.Add(hidCheckBoxState);
HtmlInputHidden hidPreviousPage = new HtmlInputHidden();
hidPreviousPage.ID = HIDDENPREVIOUSPAGE;
//
this.Controls.Add(hidPreviousPage);
break;
{
CheckBox chk = (CheckBox)e.Item.Cells[this.intCheckBoxColumn].Controls[0];
//
chk.Enabled = true;
chk.Checked = false;
chk.ID = this.ID + e.Item.ItemIndex + this.intCheckBoxColumn;
if (!this.blnClearGridStatus)
{
{
{
{
{
DataRow[] dr = dsCheckBoxState.Tables[0].Select("PageNumber" + "='" + this.CurrentPageIndex + "'");
//                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
intCurrentPageRowCount = dr.Length;
//
hidCheckBoxState.Value = intCurrentPageRowCount.ToString();
else
{
else
{
else
{
//Make The Previous Pages Checkbox Checked If Records Exists For Them
if (!object.Equals(this.dsCheckBoxState, null))
{
if (this.dsCheckBoxState.Tables.Count == 1)
{
if (this.dsCheckBoxState.Tables[0].Rows.Count > 0)
{
//                                            
if (dr.Length == 1)
{
else
{
//                                                                                                                                                                                                    
chk.Attributes.Add("onclick", "EMSGridCheckboxState(document.all." + this.ClientID + ", " + this.CurrentPageIndex + ", '" + this.strHiddenCheckBoxState + "', '" + this.strNoOfRecordsCheckBoxState + "', '" + this.strCheckBoxStateCount + "', document.forms[0].item(\"" + this.strHeaderCheckBoxId + "\"), " + this.PageSize + ",'" + this.strHiddenPreviousPage + "');");
break;
/// <summary>
/// Helper Function Adds The Client Side Functionality For Checkbox State
/// </summary>
private void AddClientSideScript()
{
sbCheckAll.Append("<script>");
sbCheckAll.Append("function EMSGridCheckAll(EmsGridId, HeaderCheckBox)");
sbCheckAll.Append("{");
sbCheckAll.Append("for(var row = 1; row < EmsGridId.rows.length; row++)");
sbCheckAll.Append("{");
sbCheckAll.Append("for(var col=0; col < EmsGridId.rows[row].cells.length; col++)");
sbCheckAll.Append("{");
sbCheckAll.Append("for(cells = 0; cells < EmsGridId.rows[row].cells(col).children.length; cells++)");
sbCheckAll.Append("{");
sbCheckAll.Append("if(EmsGridId.rows[row].cells(col).children[cells].type == \"checkbox\")");
sbCheckAll.Append("{");
sbCheckAll.Append("EmsGridId.rows[row].cells(col).children[cells].checked = HeaderCheckBox.checked"); ;
sbCheckAll.Append("}");
sbCheckAll.Append("break;");
sbCheckAll.Append("}");
sbCheckAll.Append("}");
sbCheckAll.Append("}");
sbCheckAll.Append("}");
sbCheckAll.Append("</script>");
StringBuilder sbCheckBoxState = new StringBuilder();
sbCheckBoxState.Append("<script>");
//Adding The Function Attribute
sbCheckBoxState.Append("function EMSGridCheckboxState(EmsGridId, CurrentPageIndex, hidCheckBoxState, hidNoOfRecordsCheckBoxState, hidCheckRecordsCount, HeaderCheckBox, PageSize, PreviousPage)");
//Opening The function Braces
sbCheckBoxState.Append("{");
//Validating If The DataGrid Exisits
sbCheckBoxState.Append("if(EmsGridId == null)");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("alert('Invalid DataGrid Name');");
sbCheckBoxState.Append("return");
sbCheckBoxState.Append("}");
//Validating If The CurrentPageIndex Exisits
sbCheckBoxState.Append("if(CurrentPageIndex == null)");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("alert('Invalid Page Index');");
sbCheckBoxState.Append("return;");
sbCheckBoxState.Append("}");
//Converting hidCheckBoxState To An Object
sbCheckBoxState.Append("hidCheckBoxState = eval('document.forms[0].item(\"' + hidCheckBoxState +  '\")');");
//Converting hidNoOfRecordsCheckBoxState To An Object
sbCheckBoxState.Append("hidNoOfRecordsCheckBoxState = eval('document.forms[0].item(\"' + hidNoOfRecordsCheckBoxState +  '\")');");
//PreviousPage
sbCheckBoxState.Append("PreviousPage = eval('document.forms[0].item(\"' + PreviousPage +  '\")');");
//
sbCheckBoxState.Append("hidNoOfRecordsCheckBoxState.value = 0;");
//
sbCheckBoxState.Append("hidCheckRecordsCount = eval('document.forms[0].item(\"' + hidCheckRecordsCount +  '\")');");
//Validating if the converted hidCheckBoxState is an object
sbCheckBoxState.Append("if(hidCheckBoxState == null)");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("alert('Invalid Check Box State Control');");
sbCheckBoxState.Append("return;");
sbCheckBoxState.Append("}");
//Validating if the converted hidNoOfRecordsCheckBoxState is an object
sbCheckBoxState.Append("if(hidNoOfRecordsCheckBoxState == null)");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("alert('Invalid No Of Records Check Box State Control');");
sbCheckBoxState.Append("return;");
sbCheckBoxState.Append("}");
//Validating if the converted hidNoOfRecordsCheckBoxState is an object
sbCheckBoxState.Append("if(hidCheckRecordsCount == null)");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("alert('Invalid Check Records Count Control');");
sbCheckBoxState.Append("return;");
sbCheckBoxState.Append("}");
//Validating if the PreviousPage Control Exists
sbCheckBoxState.Append("if(PreviousPage == null)");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("alert('Invalid Previous Page Control');");
sbCheckBoxState.Append("return;");
sbCheckBoxState.Append("}");
//Validating if the converted hidCheckBoxState's value is null
sbCheckBoxState.Append("if(hidCheckBoxState.value == \"\")");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("var data = CurrentPageIndex;");
sbCheckBoxState.Append("var pkdata;");
sbCheckBoxState.Append("for(var row = 1; row < EmsGridId.rows.length; row++)");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("for(var col=0; col < EmsGridId.rows[row].cells.length; col++)");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("for(cells = 0; cells < EmsGridId.rows[row].cells(col).children.length; cells++)");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("if(EmsGridId.rows[row].cells(col).children[cells].type == \"checkbox\")");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("if(EmsGridId.rows[row].cells(col).children[cells].checked)");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("if(pkdata == null)");
sbCheckBoxState.Append("{");
//sbCheckBoxState.Append("alert(EmsGridId.rows[row].id.length);");
sbCheckBoxState.Append("if(EmsGridId.rows[row].id.length > 0)");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("pkdata = EmsGridId.rows[row].id;");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("else");
sbCheckBoxState.Append("{");
//sbCheckBoxState.Append("alert(EmsGridId.rows[row].id.length);");
sbCheckBoxState.Append("if(EmsGridId.rows[row].id.length > 0)");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("pkdata = pkdata + \"^\" + EmsGridId.rows[row].id;");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("break;");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("if(pkdata == null)");
sbCheckBoxState.Append("{");
//
sbCheckBoxState.Append("PreviousPage.value = CurrentPageIndex;");
//
sbCheckBoxState.Append("return;");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("else");
sbCheckBoxState.Append("{");
//
sbCheckBoxState.Append("PreviousPage.value = CurrentPageIndex;");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("hidCheckBoxState.value = data +\"~\"+ pkdata;");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("else");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("pagespliter = hidCheckBoxState.value.split(\"|\");");
sbCheckBoxState.Append("var data;");
sbCheckBoxState.Append("for(var page = 0;  page++)");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("pageIndex   = pagespliter[page].split(\"~\");");
sbCheckBoxState.Append("if(pageIndex[0] == CurrentPageIndex)");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("for(var row = 1; row < EmsGridId.rows.length; row++)");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("for(var col=0; col < EmsGridId.rows[row].cells.length; col++)");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("for(cells = 0; cells < EmsGridId.rows[row].cells(col).children.length; cells++)");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("if(EmsGridId.rows[row].cells(col).children[cells].type == \"checkbox\")");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("if(EmsGridId.rows[row].cells(col).children[cells].checked)");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("if(data == null)");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("if(EmsGridId.rows[row].id != \"\")");
sbCheckBoxState.Append("{");
//sbCheckBoxState.Append("alert(EmsGridId.rows[row].id.length);");
sbCheckBoxState.Append("if(EmsGridId.rows[row].id.length > 0)");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("data = EmsGridId.rows[row].id;");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("else");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("if(EmsGridId.rows[row].id != \"\")");
sbCheckBoxState.Append("{");
//sbCheckBoxState.Append("alert(EmsGridId.rows[row].id.length);");
sbCheckBoxState.Append("if(EmsGridId.rows[row].id.length > 0)");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("data = data + \"^\" + EmsGridId.rows[row].id;");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("break;");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("if(data == null)");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("pagespliter[page] = \"\"");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("else");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("pageIndex[1] = data;");
sbCheckBoxState.Append("pagespliter[page] = pageIndex.join(\"~\");");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("break;");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("hidCheckBoxState.value = pagespliter.join(\"|\");");
//
sbCheckBoxState.Append("PreviousPage.value = CurrentPageIndex;");
sbCheckBoxState.Append("}");
//Adding The Number Of Rows Checked Across EMS
sbCheckBoxState.Append("var noofrows = hidCheckBoxState.value;");
sbCheckBoxState.Append("var noofrows = noofrows.split(\"~\");");
sbCheckBoxState.Append("if(noofrows.length == null)");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("hidNoOfRecordsCheckBoxState.value = 0;");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("else");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("if(noofrows.length == 2)");
sbCheckBoxState.Append("{");
//sbCheckBoxState.Append("alert(noofrows[1]);");
sbCheckBoxState.Append("noofrows[1] = noofrows[1].split(\"^\");");
sbCheckBoxState.Append("if(noofrows[1].length == null)");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("hidNoOfRecordsCheckBoxState.value = 0;");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("else");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("hidNoOfRecordsCheckBoxState.value = noofrows[1].length;");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("else");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("hidNoOfRecordsCheckBoxState.value = 0;");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("}");
//sbCheckBoxState.Append("if(parseInt(hidNoOfRecordsCheckBoxState.value) == 20)");
//sbCheckBoxState.Append("{");
//            sbCheckBoxState.Append("PageSize = PageSize + 1");
//sbCheckBoxState.Append("}");
//sbCheckBoxState.Append("alert(PageSize); alert(hidNoOfRecordsCheckBoxState.value);alert(EmsGridId.rows.length);");
sbCheckBoxState.Append("if((PageSize) == parseInt(hidNoOfRecordsCheckBoxState.value))");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("HeaderCheckBox.checked = true;");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("else if((EmsGridId.rows.length - 3) == parseInt(hidNoOfRecordsCheckBoxState.value))");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("HeaderCheckBox.checked = true;");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("else");
sbCheckBoxState.Append("{");
sbCheckBoxState.Append("HeaderCheckBox.checked = false;");
sbCheckBoxState.Append("}");
//sbCheckBoxState.Append("alert('Current Records =' + hidNoOfRecordsCheckBoxState.value);");
//sbCheckBoxState.Append("alert('Total Records = ' + hidCheckRecordsCount.value);");
//Closing The function Braces
//sbCheckBoxState.Append("alert(PreviousPage.value);");
//sbCheckBoxState.Append("alert('Hello');");
sbCheckBoxState.Append("}");
sbCheckBoxState.Append("</script>");
this.Page.RegisterClientScriptBlock("sbCheckAll", sbCheckAll.ToString());
this.Page.RegisterClientScriptBlock("sbCheckBoxState", sbCheckBoxState.ToString());
#endregion
/// <summary>
/// Implementing the DataGrid Template Class
/// </summary>
public class DataGridTemplate : ITemplate
{
/// <summary>
/// ListItemType Variable Declaration
/// </summary>
ListItemType listitemtype;
/// <summary>
/// columnnumber Variable Declaration
/// </summary>
int columnnumber;
/// <summary>
/// columnname Variable Declaration
/// </summary>
string columnname;
/// <summary>
/// columncaption Variable Declaration
/// </summary>
string columncaption;
/// <summary>
/// columntype Variable Declaration
/// </summary>
string columntype;
/// <summary>
/// columnmaxlength Variable Declaration
/// </summary>
int columnmaxlength;
/// <summary>
/// allowsort Variable Declaration
/// </summary>
bool allowsort;
/// <summary>
/// headercssclass Variable Declaration
/// </summary>
string headercssclass;
/// <summary>
/// blnFullEditable Variable Declaration
/// </summary>
bool blnFullEditable;
/// <summary>
/// blnReadOnly Variable Declaration
/// </summary>
bool blnReadOnly;
/// <summary>
/// blnAllowDBNull Variable Declaration
/// </summary>
bool blnAllowDBNull;
/// <summary>
/// blnEnhanceEdit Variable Declaration
/// </summary>
bool blnEnhanceEdit;
/// <summary>
///  cellname Variable Declaration
/// </summary>
string cellname;
/// <summary>
/// guid Varaible Declaration
/// </summary>
string guid;
/// <summary>
/// PropertyCollection Variable Declaration
/// </summary>
System.Data.PropertyCollection PropertyCollection;
/// <summary>
/// RequiredFieldValidator style sheet declaration
/// </summary>
const string VALIDATORSTYLESHEET = "RequiredFieldValidator"
/// <summary>
/// RangeValidator Error Message
/// </summary>
const string RANGEERRORMESSAGE = "<BR><BLINK>||Invalid Data||</BLINK>"
/// <summary>
/// Required Field Error Message
/// </summary>
const string REQUIREDERRORMESSAGE = "<BR><BLINK>||Required||</BLINK>"
/// <summary>
/// DropDown List Default Value
/// </summary>
const string DROPDOWNDEFAULTTEXT = "||------SELECT------||"
/// <summary>
/// ReadOnly TextBox Style
/// </summary>
const string READONLYTEXTBOXSTYLE = "ReadOnlyTextBoxStyle"
/// <summary>
/// Range Validator For Decimal field Max Value
/// </summary>
string DecimalMaxValue = System.Configuration.ConfigurationSettings.AppSettings["DecimalMaxValue"];
/// <summary>
/// Range Validator For Decimal field Min Value
/// </summary>
string DecimalMinValue = System.Configuration.ConfigurationSettings.AppSettings["DecimalMinValue"];
/// <summary>
/// CheckBoxState Variable Declaration
/// </summary>
bool blnCheckBoxState;
/// <summary>
/// CheckBox Column Variable Declaration
/// </summary>
int intCheckBoxColumn;
#endregion
#region Public Method Of This Class
/// <summary>
/// contractor
/// </summary>
/// <param name="listItemType">The Type Of Item To Be Added</param>
/// <param name="columnName">Name Of The Column</param>
/// <param name="columnCaption">Column Heading</param>
/// <param name="columnNumber">Column Number</param>
/// <param name="columnType">DataType Of The Column</param>
/// <param name="allowSort">If Sorting Is Enabled</param>
/// <param name="headerCssClass">Style Sheet Class</param>
/// <param name="blnFullEditable">If Fully Editable</param>
/// <param name="blnReadOnly"></param>
/// <param name="PropertyCollection"></param>
/// <param name="AllowDBNull"></param>
/// <param name="blnEnhanceEdit"></param>
/// <param name="strcellname"></param>
/// <param name="columnmaxlength"></param>
/// <param name="blnCheckBoxState"></param>
/// <param name="intCheckBoxColumn"></param>
public DataGridTemplate(ListItemType listItemType, string columnName, string columnCaption, int columnNumber, string columnType, bool allowSort, string headerCssClass, bool blnFullEditable, bool blnReadOnly, System.Data.PropertyCollection PropertyCollection, bool AllowDBNull, bool blnEnhanceEdit, string strcellname, int columnmaxlength, bool blnCheckBoxState, int intCheckBoxColumn)
{
this.listitemtype = listItemType;
//set the column number
this.columnnumber = columnNumber;
//set the column name
this.columnname = columnName;
//set the column caption
this.columncaption = columnCaption;
//set the column type
this.columntype = columnType;
//set the sort property
this.allowsort = allowSort;
//set the header css class
this.headercssclass = headerCssClass;
//set the FullEditable
this.blnFullEditable = blnFullEditable;
//Used Is A Column Is ReadOnly
this.blnReadOnly = blnReadOnly;
//Any Other Specific Data Column Collection
this.PropertyCollection = PropertyCollection;
//Puts A Required Field Validator Control
this.blnAllowDBNull = AllowDBNull;
//Puts The Appropriate Validator Controls
this.blnEnhanceEdit = blnEnhanceEdit;
//Giving a unique name to a control
this.cellname = strcellname;
//Maxlength Of The Column
this.columnmaxlength = columnmaxlength;
//CheckBoxState
this.blnCheckBoxState = blnCheckBoxState;
this.intCheckBoxColumn = intCheckBoxColumn;
/// <summary>
/// implement the InstantiateIn method
/// </summary>
/// <param name="container"></param>
public void InstantiateIn(System.Web.UI.Control container)
{
//for listitem type, set the template style
#region Setting Template Style
switch (listitemtype)
{
case ListItemType.Header:
{
{
{
container.Controls.Add(chkHeader);
else
{
{
container.Controls.Add(lc);
else
{
linkButton.Text = columncaption;
linkButton.CommandName = "sort"
linkButton.CommandArgument = columnname;
linkButton.CssClass = headercssclass;
container.Controls.Add(linkButton);
//TableCell x = new TableCell();
break;
{
container.Controls.Add(lc);
else
{
linkButton.Text = columncaption;
linkButton.CommandName = "sort"
linkButton.CommandArgument = columnname;
linkButton.CssClass = headercssclass;
container.Controls.Add(linkButton);
//TableCell x = new TableCell();
break;
else
{
{
{
else
{
container.Controls.Add(lc);
else
{
if (!object.Equals(PropertyCollection[EMSDataGridExtendedProperties.CustomColumnHeading], null))
{
else
{
linkButton.CommandName = "sort"
linkButton.CommandArgument = columnname;
linkButton.CssClass = headercssclass;
container.Controls.Add(linkButton);
//TableCell x = new TableCell();
break;
case ListItemType.Item:
{
//check the column type and set the control based on the datatype
switch (columntype)
{
lc.DataBinding += new EventHandler(lc_SelectedDropDown);
container.Controls.Add(lc);
DropDownList dp = new DropDownList();
this.BindDropDown(dp);
dp.SelectedValue = lc.Text;
//dp.PreRender += new EventHandler(ddl_SelectedDropDown);
container.Controls.Add(dp);
break;
//tb.ID = this.cellname;
if (this.columnmaxlength > 0)
{
tb.DataBinding += new EventHandler(tb_DataBinding);
if (!object.Equals(PropertyCollection[EMSDataGridExtendedProperties.Width], null))
{
if (!object.Equals(PropertyCollection[EMSDataGridExtendedProperties.CssClass], null))
{
container.Controls.Add(tb);
//Adding The Elipse Button If Required
if (!object.Equals(PropertyCollection[EMSDataGridExtendedProperties.ElipseButton], null))
{
elipseButton.Value = "..."
elipseButton.Attributes.Add("Style", "CustomButtonStyle");
elipseButton.Attributes.Add("title", "||Click Here To Open Popup||");
container.Controls.Add(elipseButton);
break;
cb.DataBinding += new EventHandler(cb_DataBinding);
if (!object.Equals(PropertyCollection[EMSDataGridExtendedProperties.Width], null))
{
if (!object.Equals(PropertyCollection[EMSDataGridExtendedProperties.CssClass], null))
{
container.Controls.Add(cb);
break;
tb1.DataBinding += new EventHandler(tb_DataBinding);
if (!object.Equals(PropertyCollection[EMSDataGridExtendedProperties.Width], null))
{
if (!object.Equals(PropertyCollection[EMSDataGridExtendedProperties.CssClass], null))
{
container.Controls.Add(tb1);
break;
tb2.DataBinding += new EventHandler(tb_DataBinding);
if (!object.Equals(PropertyCollection[EMSDataGridExtendedProperties.Width], null))
{
if (!object.Equals(PropertyCollection[EMSDataGridExtendedProperties.CssClass], null))
{
//Adding The TextBox
container.Controls.Add(tb2);
break;
tb3.DataBinding += new EventHandler(tb_DataBinding);
if (!object.Equals(PropertyCollection[EMSDataGridExtendedProperties.Width], null))
{
if (!object.Equals(PropertyCollection[EMSDataGridExtendedProperties.CssClass], null))
{
container.Controls.Add(tb3);
break;
//tb4.ID = this.cellname;
tb4.DataBinding += new EventHandler(tb_DataBinding);
if (!object.Equals(PropertyCollection[EMSDataGridExtendedProperties.Width], null))
{
if (!object.Equals(PropertyCollection[EMSDataGridExtendedProperties.CssClass], null))
{
container.Controls.Add(tb4);
break;
tb5.DataBinding += new EventHandler(tb_DataBinding);
if (!object.Equals(PropertyCollection[EMSDataGridExtendedProperties.Width], null))
{
if (!object.Equals(PropertyCollection[EMSDataGridExtendedProperties.CssClass], null))
{
container.Controls.Add(tb5);
break;
tb6.DataBinding += new EventHandler(tb_DataBinding);
if (!object.Equals(PropertyCollection[EMSDataGridExtendedProperties.Width], null))
{
if (!object.Equals(PropertyCollection[EMSDataGridExtendedProperties.CssClass], null))
{
container.Controls.Add(tb6);
break;
if (!Object.Equals(PropertyCollection[EMSDataGridExtendedProperties.Width], null))
{
else
{
if (!Object.Equals(PropertyCollection[EMSDataGridExtendedProperties.CssClass], null))
{
else
{
tb7.ReadOnly = true;
tb7.DataBinding += new EventHandler(tb7_DataBinding);
container.Controls.Add(tb7);
break;
#endregion
else
{
switch (columntype)
{
cb.DataBinding += new EventHandler(cb_DataBinding);
cb.Enabled = false;
if (!Object.Equals(PropertyCollection[EMSDataGridExtendedProperties.Width], null))
{
if (!Object.Equals(PropertyCollection[EMSDataGridExtendedProperties.CssClass], null))
{
container.Controls.Add(cb);
break;
{
else
{
container.Controls.Add(lc);
break;
container.Controls.Add(lc);
break;
#endregion
break;
case ListItemType.EditItem:
if (this.blnEnhanceEdit && !this.blnReadOnly)
{
//check the column type and set the control based on the datatype
switch (columntype)
{
{
lc.DataBinding += new EventHandler(lc_SelectedDropDown);
container.Controls.Add(lc);
DropDownList dp = new DropDownList();
container.Controls.Add(dp);
break;
tb.MaxLength = this.columnmaxlength;
tb.DataBinding += new EventHandler(tb_DataBinding);
if (!Object.Equals(PropertyCollection[EMSDataGridExtendedProperties.Width], null))
{
if (!Object.Equals(PropertyCollection[EMSDataGridExtendedProperties.CssClass], null))
{
container.Controls.Add(tb);
//Adding The Elipse Button If Required
if (!object.Equals(PropertyCollection[EMSDataGridExtendedProperties.ElipseButton], null))
{
elipseButton.Value = "..."
elipseButton.Attributes.Add("Style", "CustomButtonStyle");
elipseButton.Attributes.Add("title", "||Click Here To Open Popup||");
container.Controls.Add(elipseButton);
break;
cb.DataBinding += new EventHandler(cb_DataBinding);
//cb.ID = this.cellname;
if (!Object.Equals(PropertyCollection[EMSDataGridExtendedProperties.Width], null))
{
if (!Object.Equals(PropertyCollection[EMSDataGridExtendedProperties.CssClass], null))
{
container.Controls.Add(cb);
break;
//tb1.ID = this.cellname;
tb1.DataBinding += new EventHandler(tb_DataBinding);
if (!Object.Equals(PropertyCollection[EMSDataGridExtendedProperties.Width], null))
{
if (!Object.Equals(PropertyCollection[EMSDataGridExtendedProperties.CssClass], null))
{
container.Controls.Add(tb1);
break;
tb2.DataBinding += new EventHandler(tb_DataBinding);
if (!Object.Equals(PropertyCollection[EMSDataGridExtendedProperties.Width], null))
{
if (!Object.Equals(PropertyCollection[EMSDataGridExtendedProperties.CssClass], null))
{
container.Controls.Add(tb2);
break;
tb3.DataBinding += new EventHandler(tb_DataBinding);
if (!Object.Equals(PropertyCollection[EMSDataGridExtendedProperties.Width], null))
{
if (!Object.Equals(PropertyCollection[EMSDataGridExtendedProperties.CssClass], null))
{
container.Controls.Add(tb3);
break;
tb4.DataBinding += new EventHandler(tb_DataBinding);
if (!Object.Equals(PropertyCollection[EMSDataGridExtendedProperties.Width], null))
{
if (!Object.Equals(PropertyCollection[EMSDataGridExtendedProperties.CssClass], null))
{
container.Controls.Add(tb4);
break;
tb5.DataBinding += new EventHandler(tb_DataBinding);
if (!Object.Equals(PropertyCollection[EMSDataGridExtendedProperties.Width], null))
{
if (!Object.Equals(PropertyCollection[EMSDataGridExtendedProperties.CssClass], null))
{
container.Controls.Add(tb5);
break;
tb6.DataBinding += new EventHandler(tb_DataBinding);
if (!Object.Equals(PropertyCollection[EMSDataGridExtendedProperties.Width], null))
{
if (!Object.Equals(PropertyCollection[EMSDataGridExtendedProperties.CssClass], null))
{
container.Controls.Add(tb6);
break;
tb7.DataBinding += new EventHandler(tb_DataBinding);
if (!Object.Equals(PropertyCollection[EMSDataGridExtendedProperties.Width], null))
{
else
{
if (!Object.Equals(PropertyCollection[EMSDataGridExtendedProperties.CssClass], null))
{
else
{
tb7.ReadOnly = true;
container.Controls.Add(tb7);
break;
#endregion
else
{
//check the column type and set the control based on the datatype
switch (columntype)
{
//Bind Data
container.Controls.Add(dp);
break;
tb.DataBinding += new EventHandler(tb_DataBinding);
container.Controls.Add(tb);
break;
cb.DataBinding += new EventHandler(cb_DataBinding);
container.Controls.Add(cb);
break;
tb1.DataBinding += new EventHandler(tb_DataBinding);
container.Controls.Add(tb1);
break;
tb2.DataBinding += new EventHandler(tb_DataBinding);
container.Controls.Add(tb2);
break;
tb3.DataBinding += new EventHandler(tb_DataBinding);
container.Controls.Add(tb3);
break;
tb4.DataBinding += new EventHandler(tb_DataBinding);
container.Controls.Add(tb4);
break;
tb5.DataBinding += new EventHandler(tb_DataBinding);
container.Controls.Add(tb5);
break;
tb6.DataBinding += new EventHandler(tb_DataBinding);
container.Controls.Add(tb6);
break;
#endregion
break;
case ListItemType.Footer:
break;
#endregion
#endregion
#region Events Raised By The InstantiateIn Methods Implementation
/// <summary>
/// Label Binding Data Event
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void lc_DataBinding(object sender, EventArgs e)
{
{
DataRowView container = (DataRowView)((DataGridItem)literal.NamingContainer).DataItem;
literal.Text = container.Row.ItemArray[columnnumber].ToString();
Regex re = new Regex(@"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*");
if (re.IsMatch(literal.Text)) // for email address add a mailto: hyperlink
{
/// <summary>
/// Event Is Raised To Find The Description Of UniqueIdentifiers
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void lc_SearchDataBinding(object sender, EventArgs e)
{
{
DataRowView container = (DataRowView)((DataGridItem)literal.NamingContainer).DataItem;
guid = container.Row.ItemArray[columnnumber].ToString();
literal.ID = guid;
literal.Text = this.SearchDataTable(this.PropertyCollection[EMSDataGridExtendedProperties.DataTable], this.PropertyCollection[EMSDataGridExtendedProperties.DataColumnSearch], this.PropertyCollection[EMSDataGridExtendedProperties.DataTextField], guid);
else
{
/// <summary>
/// Event Is Raised To Set The Default Selected Value
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void lc_SelectedDropDown(object sender, EventArgs e)
{
DataRowView container = (DataRowView)((DataGridItem)literal.NamingContainer).DataItem;
if (!object.Equals(container.Row.ItemArray[columnnumber], Guid.Empty))
{
//this.strSelectedValue = container.Row.ItemArray[columnnumber].ToString();
/// <summary>
/// This Event Is Used For Selected DropDown
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ddl_SelectedDropDown(object sender, EventArgs e)
{
DataRowView container = (DataRowView)((DataGridItem)ddl.NamingContainer).DataItem;
//ddl.SelectedValue = this.strSelectedValue;
//this.strSelectedValue = string.Empty;
/// <summary>
/// Used To Set The Value For The TextBox Based On The DataType
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void tb_DataBinding(object sender, EventArgs e)
{
{
DataRowView container = (DataRowView)((DataGridItem)tb.NamingContainer).DataItem;
tb.Text = container.Row.ItemArray[columnnumber].ToString();
if (!Object.Equals(PropertyCollection[EMSDataGridExtendedProperties.ReadOnly], null))
{
{
if (container.Row[PropertyCollection[EMSDataGridExtendedProperties.ReadOnly].ToString()].GetType().ToString() == "System.Boolean")
{
tb.ReadOnly = blnFlag;
//Setting ReadOnly Style Of The TextBox
if (blnFlag)
{
{
else
{
/// <summary>
/// Used To Set The Value For The TextBox Based On The DataType
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void tb7_DataBinding(object sender, EventArgs e)
{
{
DataRowView container = (DataRowView)((DataGridItem)tb.NamingContainer).DataItem;
tb.Text = GetValidDate(container.Row.ItemArray[columnnumber]).ToString();
tb.ReadOnly = true;
tb.CssClass = READONLYTEXTBOXSTYLE;
/// <summary>
/// Used To Set The CheckBox Value
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void cb_DataBinding(object sender, EventArgs e)
{
{
DataRowView container = (DataRowView)((DataGridItem)cb.NamingContainer).DataItem;
if (!object.Equals(container.Row.ItemArray[columnnumber], DBNull.Value))
{
#endregion
#region Helper Function Used By This Class
/// <summary>
/// Helper Function Used Populate The DropDown Box
/// </summary>
/// <param name="ddl"></param>
private void BindDropDown(DropDownList ddl)
{
{
if (!object.Equals(dt.Rows[0][0], DBNull.Value))
{
dr[0] = DBNull.Value;
dr[1] = DROPDOWNDEFAULTTEXT;
dt.Rows.InsertAt(dr, 0);
ddl.DataSource = dt;
if (!object.Equals(this.PropertyCollection[EMSDataGridExtendedProperties.DataValueField], null))
{
else
{
if (!object.Equals(this.PropertyCollection[EMSDataGridExtendedProperties.DataTextField], null))
{
else
{
ddl.DataBind();
else
{
/// <summary>
/// Helper Function Used To Set The Description For The Guid
/// </summary>
/// <param name="objDataTable"></param>
/// <param name="objDataColumn"></param>
/// <param name="strId"></param>
/// <returns></returns>
private string SearchDataTable(object objDataTable, object objDataColumn, object objDataText, string strId)
{
if (strId.Length == 0)
{
//
if (!object.Equals(objDataTable, null))
{
{
if (dr.Length == 0)
{
else
{
//return dr[0][1].ToString();                        
else
{
else
{
/// <summary>
/// Helper Function Used For Date Conversion
/// </summary>
/// <param name="dtDate"></param>
/// <returns></returns>
public DateTime DateConvertor(string strDate)
{
return DateTime.ParseExact(strDate, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture, DateTimeStyles.None);
/// <summary>
/// Helper Function Used For Date Conversion
/// </summary>
/// <param name="dtDate"></param>
/// <returns></returns>
public string DateConvertor(DateTime dtDate)
{
/// <summary>
/// Helper Function Used For DataRow Value Conversion
/// </summary>
/// <param name="objDate"></param>
/// <returns></returns>
private object GetValidDate(object objDate)
{
{
else
{
/// <summary>
/// Helper Function Used For DataRow Value Conversion
/// </summary>
/// <param name="strValue"></param>
/// <returns></returns>
private object GetValidValue(string strValue)
{
if (strValue.Length == 0)
{
else
{
#endregion