943,829 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Marked Solved
  • Views: 907
  • ASP.NET RSS
Nov 19th, 2008
0

Checking Number in a String and calculate..

Expand Post »
Hi fellows,
My problem is, i have a datagrid where there is a boundcolumn which consists of Cadre(E1,E2.....E7).

In the same datagrid i also have two template column which consists of a textbox and a checkbox.I need to enable the textbox and check the checkbox by considering the cadre.The logic is that i got 60 employees in teh grid with various Cadre.I want to enable the textbox and Check box to the employee whose cadre is above E4(E4,E3,E2,E1).

I did this by using select case..

ASP.NET Syntax (Toggle Plain Text)
  1. Select Case DGridItem.Cells(8).Text
  2. Case "E4"
  3. txtLTa.ReadOnly = False
  4. CbLTA.Checked = True
  5. Case "E3"
  6. txtLTa.ReadOnly = False
  7. CbLTA.Checked = True
  8. Case "E2"
  9. txtLTa.ReadOnly = False
  10. CbLTA.Checked = True
  11. Case "E1"
  12. txtLTa.ReadOnly = False
  13. CbLTA.Checked = True
  14. Case Else
  15. CbLTA.Visible = False
  16. txtLTa.Visible = False
  17. End Select

But i would like to try it by keeping constant "E" and calculate the number using a IF Condition.This is what i did.
ASP.NET Syntax (Toggle Plain Text)
  1. Dim PRCbLTA As String
  2. Dim CbLTA As CheckBox
  3. Dim txtLTa As TextBox
  4. Dim PRLta As Decimal
  5. txtLTa = CType(DGridItem.FindControl("txtLTA"), TextBox)
  6. CbLTA = CType(DGridItem.FindControl("CbLTA"), CheckBox)
  7. Dim Grade As String
  8. Grade = DGridItem.Cells(8).Text
  9. Dim i As Integer
  10. If Grade = "E" & i <= 4 Then
  11. Response.Write(i)
  12. End IF
It is returning me all 0's..Could anyone help me on this.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
bharathi_n_r is offline Offline
25 posts
since Jan 2008
Nov 19th, 2008
0

Re: Checking Number in a String and calculate..

Thanks for viewing.

I myself solved it..Thanks anyway...

Here is the Code.I used Replace

ASP.NET Syntax (Toggle Plain Text)
  1. Dim PRCbLTA As String
  2. Dim CbLTA As CheckBox
  3. Dim txtLTa As TextBox
  4. Dim PRLta As Decimal
  5. txtLTa = CType(DGridItem.FindControl("txtLTA"), TextBox)
  6. CbLTA = CType(DGridItem.FindControl("CbLTA"), CheckBox)
  7. Dim Grade As String
  8. Grade = Replace(DGridItem.Cells(8).Text, "E", "")
  9. If Grade <= 4 Then
  10. txtLTa.ReadOnly = False
  11. CbLTA.Checked = True
  12. Else
  13. CbLTA.Visible = False
  14. txtLTa.Visible = False
  15. End If
Reputation Points: 10
Solved Threads: 0
Light Poster
bharathi_n_r is offline Offline
25 posts
since Jan 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: String was not recognized as a valid DateTime.
Next Thread in ASP.NET Forum Timeline: Formatted text control





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC