Question on ASP.NET

I am currently making a Manual Payrolling on ASP.NET, what I have to do is showing the payroll table which shape as below.
1 - I call the store procedure to return the table shape like below table.
2 - I bind the Grid to Datasource. Then the table will contain the data like the following table.
3 - On Page I have the code snippet:
<asp:TextBox id=txtDay1 Text='<%# DataBinder.Eval(Container, "DataItem.Day01")%>' >
...
<asp:TextBox id=txtDay1 Text='<%# DataBinder.Eval(Container, "DataItem.Day31")%>' >

|   EmpID    |    March 1    |     March 2    |    ...   |  March 31  |
|   00001    |        8          |       02          |    ...   |       8         |          8 -> Work hour
|   00002    |        02        |       02          |    ...   |       8         |         02 -> Absense code

In the table we will have 8 as "hours of work" and 02 is the "absense code".
My validation on the table is that the user can correct the "work hours", but not on the "absent code". So, the textfield which contain "absense code" should be disabled.

First, Is there any recommedation to quickly solve the problem as I presented above? But it should be adaptable on other situation, for instance, if the user want the absence code to be text like "Absence" or else.
I think I prefer the second way.

The second way is to change the stored procedure/function, that the stored procedure will return a table with data
|   EmpID    |    March1             |     March2              |    ...   |  March31             |
|   00001    |        8$True          |       02$False          |    ...   |       8$True         |          8 -> Work hour
|   00002    |        02$False       |       02$False          |    ...   |       8$True         |         02 -> Absense code

Then on Binding to DataGrid. That means
DataBinder.Eval(Container, "DataItem.Day01") will result 8$True
DataBinder.Eval(Container, "DataItem.Day02") will result 02$False

My idea is to split 8$True into 2 parts like
string[] strA = "8$True".Split("$");
strA[0] = 8
strA[1] = True
so that I can have
<asp:TextBox id=txtDay1 Text='<%#
                                                      {[DataBinder.Eval(Container, "DataItem.Day01")].Split("$")}[0]
                                              %>'
                                     Enabled='<%#
                                                      {[DataBinder.Eval(Container, "DataItem.Day01")].Split("$")}[1]
                                              %>' >
that when Page loaded.
<asp:TextBox id=txtDay1 Text='8' Enabled=True >
<asp:TextBox id=txtDay1 Text='02' Enabled=False >

But I cannot write the code on page.
Hope you understand my idea, I tried a lot.
Thanks and Regards
LVL 4
nguyenvinhtuAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

t_itaniumCommented:
hi
before you change the value in the textbox store its value in atemp variable...then check if it is an abscence code...return the old value to the text box else put the new value..
cheers
0
nguyenvinhtuAuthor Commented:
Hi everyone, thanks for commenting my question. Now I got a solution for my question.
I don't use Split function but a combination of Substring() and IndexOf(). I'll show you the answer.

<asp:TextBox id=txtDay1
     Enabled='<%# Convert.ToBoolean(
                                       Convert.ToString(
                                                  DataBinder.Eval(Container, "DataItem.Day01")
                                       ).Substring(
                                             Convert.ToString(DataBinder.Eval(Container, "DataItem.Day01")).IndexOf("$")+1)
                                         ) %>'
     Text='<%# Convert.ToString(
                                                  DataBinder.Eval(Container, "DataItem.Day01")
                                       ).Substring(
                                             0,Convert.ToString(DataBinder.Eval(Container, "DataItem.Day01")).IndexOf("$"))
%>' Runat="server">

The answer is rather complex, hope you get my idea. Because I return the string like "8$True" or "02$False", so I use the IndexOf() function to get the position of letter "$", then use Substring() function to cut up the first part for Text value, and second part for Enabled attribute.

Again, I want to thanks to everyone who help me on my topic.
0
GranModCommented:
Closed, 300 points refunded.
GranMod
The Experts Exchange
Community Support Moderator of all Ages
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.