Adding a row of textboxes dynamically for input

How to add a row of column dynamically when user click the link to add new row?

Below illustration were done in MVC framework whereby as it is not as easy as using the control directly in web form. These concerns are populate data into the drop down list, passing back all newly added data to the controller and retrieving all data for display when page load.


In my view page, I have added the below code.

dynamicAdd2In script section, I have added a few function calls in document.ready. when page load, those method will be trigger.

dynamicAdd3In initRelationship(), is to retrieve stored values to be display in the textboxes. The first ajax postback is to retrieve a list of objects of data to be display and second ajax postback is to retrieve a list of relationship type to be display in the dropdownlist. After that, it will loop through the list of relationship type to check which one is the selected one based on the data get from list of objects. After that, all the options will be added to a string of HTML code to be appended to the div tag.

dynamicAdd6When ‘add another account’ link is click, below code will be trigger to add a new row. I have used ajax to get the list of relationship type to added to dropdownlist options before append the string of HTML code to the div tag.

dynamicAdd4Below method is just solely to assigned values to the rows of textboxes if anything left out populated into the UI controls. Can ignore this is above have done it.dynamicAdd5How to pass all these data back to the controller to be process? For all the UI controls above, the name must be the same eg. p_Relationship, p_Relationship[1]…in array format. It will automatically populated into the list in the model.



When it post back to controller, you will get all the data to be process!! dynamicAdd8








First semester of MBA is over!!

I do not know how to start to express my feelings in regard to my study even though it just pass through a few months of a two years journey. But I think it is a good idea to write down my experience which is new for me. It is an interesting and unique experience for me.

I remember that on the first day to the class which is the orientation day, I was very nervous, wondering how difficult the course will be as “MBA” sounds so high which I cant achieve easily or rather more suitable for experience executives/managers. Figuring out did I made a mistake in taking up this decision. Of course I have my own reason to pursue this course, may be I’ll share in later post. Anyway so here I am, in the class with a group of unknown and different age group of people who pursue the same course. They are smart, professional and experience in each respective field. These people are from engineering, human resource, architect, legal, finance, accounting, supply chain, operation, management, compliance, sales and marketing and IT background. It is interesting to know these people as they have different ideas and suggestions from different perspective that make the class interesting, broaden the way of viewing on a single matter from different point of view. It is nice to be with them as they will encourage and help one another in study or work life, and gradually my fear were reduce and have confidence to go on with them in this few months.

The lecture class were intensive and it is challenging to absorb all the stuff in that few days. Assignments were also challenging as it is a team work rather than an individual task. So group members come into place where coordination and commitment to work on each allocated part were needed in order that the work be done complete on schedule so that other assignments would be carried out following after that as planned. Argument and dissatisfaction do exist as different opinions, characteristics and leadership style to lead and complete an assignment. However, it is a good time to learn to mange dispute and come to find a common understanding which fit best to all.  As time pass, the understanding toward each members were improve, and it will be easier to move as one in completing a task.

MPIO revision
MPIO revision

Exam, the nightmare that haunted everyone as no one had taken any exam for the past few years.  However this would never defeat us as everyone will still spend time to discuss and revise the subjects together, helping one another especially  in the weaker areas.

I think that throughout this semester, it is fun and interesting regardless in class or in group as I gain more knowledge and soft-skills which helps me in my future career progression. I do look forward for coming semester to meet new challenges. So for now here is the end for first semester. Let’s have a good break!!

TF400018: The local version table for the local workspace ‘pc name’;’user’ could not be opened. The workspace version table contains an unknown schema version.

I had this problem yesterday, my nightmare. First thing come into my mind is to back all my project files. As I have a lot of branches in TFS for different projects. I’ll share what I did to solve this issue.

1. Backup all projects. It takes a lot of time, but is worth it I think, just in case.

2. remove current workspace and reset the workspace to the current project folder. You can find it here. File -> Source Control -> Advanced -> Workspace.

3. Go to Source Control Explorer and get the latest version of your project.

4. Close the Visual Studio.

5. Go to the project folder in your local PC and replace the projects folder with the one you have backup.

6. Open the project in Visual Studio. All your newly added and uncheck-in files will be inside. Add them back to the project.

* This can be done unless there is no one updated the project in TFS while you are solving this issue, else you have to get latest version after adding your newly added files.

Repeat page header in each page – Crystal Reports

By default, crystal report will automatically display the page header in each page. But if there is more than one report, where now I have few subreports in a report where each subreport contain its own page header, it will not display the page header in a new page. I have tried to use this method and it works to display the page header for each subreport in each page.


In each of the subreports,

1. add a formula field.

cr22. Put in this formula in the formula field as below


3. Group by the formula field

cr44. Put all the columns to the group header section


Each page header will be display nicely in each page.

NHibernate to handle search and paging from stored procedure

Basically my task is to create a page that display data in grid, able to filter (search), and print the data I retrieve from a stored procedure using NHibernate.


I will pass a filter with few parameter into the SP to retrieve the data to be display.

In xml file, I have added ‘sql-query’ query tag to query out the data. ‘query-param’ is the parameter to pass into the SP.


in .hbm.xml file:

<?xml version=”1.0″ encoding=”utf-8″?>
<hibernate-mapping namespace=”Domain.Entity” assembly=”Domain” xmlns=”urn:nhibernate-mapping-2.2″>
<class name=”Domain.Entity.ClientAccountReport, Domain” table=”ClientAccountReport_UI” schema=”dbo”>
<id name=”Id” column=”[Id]”>
<generator class=”native”/>
<property name=”SalesPerson”/>
<property name=”SalesPersonName”/>
<property name=”SalesPersonOpenDate”/>
<property name=”ClientAccountType”/>
<property name=”ClientCode” />
<property name=”ClientName”/>
<property name=”AppointCode”/>
<property name=”AppointName”/>
<property name=”AppointPersonCreatedDate”/>
<property name=”AppointPersonAmendedDate”/>
<property name=”AuditDate”/>
<property name=”AuditRecordID”/>
<property name=”FieldName”/>
<property name=”ActionType”/>
<property name=”OldValue”/>
<property name=”NewValue”/>
<property name=”Remarks”/>
<property name=”UserID”/>
<property name=”OpenDate”/>
<property name=”CloseDate”/>
<property name=”LastActiveDate”/>
<property name=”ClientDeleteDate”/>

<sql-query name=”ClientAccountReport_UI” callable=”true”>
<query-param name=”ClientCode” type=”String”/>
<query-param name=”ClientRefTypeCode” type=”String”/>
<query-param name=”ActionType” type=”String”/>
<query-param name=”AuditDate” type=”DateTime”/>
<return class=”ClientAccountReport”>
<return-property column=”ID” name=”Id” />
<return-property column=”SalesPerson” name=”SalesPerson” />
<return-property column=”SalesPersonName” name=”SalesPersonName” />
<return-property column=”SalesPersonOpenDate” name=”SalesPersonOpenDate” />
<return-property column=”ClientAccountType” name=”ClientAccountType” />
<return-property column=”ClientCode” name=”ClientCode” />
<return-property column=”ClientName” name=”ClientName” />
<return-property column=”AppointCode” name=”AppointCode” />
<return-property column=”AppointName” name=”AppointName” />
<return-property column=”AppointPersonCreatedDate” name=”AppointPersonCreatedDate” />
<return-property column=”AppointPersonAmendedDate” name=”AppointPersonAmendedDate” />
<return-property column=”AuditDate” name=”AuditDate” />
<return-property column=”AuditRecordID” name=”AuditRecordID” />
<return-property column=”FieldName” name=”FieldName” />
<return-property column=”ActionType” name=”ActionType” />
<return-property column=”OldValue” name=”OldValue” />
<return-property column=”NewValue” name=”NewValue” />
<return-property column=”Remarks” name=”Remarks” />
<return-property column=”UserID” name=”UserID” />
<return-property column=”OpenDate” name=”OpenDate” />
<return-property column=”CloseDate” name=”CloseDate” />
<return-property column=”LastActiveDate” name=”LastActiveDate” />
<return-property column=”ClientDeleteDate” name=”ClientDeleteDate” />
exec [ClientAccountReport_UI] @ClientCode=:ClientCode, @ClientRefTypeCode=:ClientRefTypeCode, @ActionType=:ActionType, @AuditDate=:AuditDate


In Dao.cs  class file

public void GetClientAccountReportByPage(IPage<ClientAccountReport> page, IList<IFilter> filters)
HibernateDaoHelp.SearchByPageForSP(page, “ClientAccountReport_UI”, filters);


In HibernateDaoHelp.cs class file

public void SearchByPageForSP(IPage<T> page, string hql, IList<FXBOSS.Utils.IFilter> Filters)
IQuery iQuery = this.GetSession().GetNamedQuery(hql);

if (Filters.Count > 0)
foreach (var obj in Filters)
if ( == 0)
iQuery.SetParameter(obj.field, String.Empty);

IList<T> ListOfObj = iQuery.List<T>();

if (page.pageSize != -1)
var list = ListOfObj.Skip((page.pageNo – 1) * page.pageSize).Take(page.pageSize).ToList();
page.totalCount = ListOfObj.Count();
page.result = list;
var list = ListOfObj.ToList();
page.totalCount = ListOfObj.Count();
page.result = list;


In controller.cs file

private Page<ClientAccountReport> filterPage(Page<ClientAccountReport> Page, string filters)
SystemSeg.GetClientAccountReportByPage(Page, FilterUtil.GetQuery<ClientAccountReport>(filters));
return Page;