Hi All,
I really need your help on this.
I have sent you the piece of the code I am having trouble with. I am adding a
text box, a validator and a calander icon in the coloum of one of the rows of
my datagrid.
I am able to see the test box and the calander icon next to it in the cell of
the grid. I am doing all this in the code behind. I want to be able the users
to pick up the date from the calander and insert it in to the text box and do
date validation. That is what I am trying below in the code. I see all of them
added in the cell of the data grid. I am having a problem with picking the data
from the calenaer to populate the textbox and to validate the date. This is the
piece of the code which should suppose to allow them to pick the date .
How should I replace the code in red, how should I refer to the textbox.
The whole code is below. I will explain more if I am not clear. Your help is
highly appreciated
Private Sub dgrdConsolidate_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
dgrdConsolidate.ItemDataBound
Dim mylabel As Label
Dim myval As CompareValidator
Dim mycell As TableCell
Select Case e.Item.Cells(1).Text
Case 1
Dim mytextbox As New TextBox
Manage = New TextBox
Manage.ID = "CtrlQ1"
e.Item.Cells(3).Controls.Add(Manage)
mylabel = New Label
mylabel.ID = "lbl1"
mylabel.Text = " <img src=""../images/buttons/smallcalendar.gif""
style=""cursor:hand""
onclick=""window.open('../includes/calendarpopup.aspx?textbox=ctrlQ1&Date=' +
document.ctrlQ1.value,'cal','width=250,height=225,left=270,top=180')""
id=""imgCalStart"">"
myval = New CompareValidator
myval.ID = "val1"
myval.Type = ValidationDataType.Date
myval.Operator = ValidationCompareOperator.GreaterThan
myval.ValueToCompare = "1/1/1900"
myval.Display = ValidatorDisplay.None
' mytextbox = e.Item.FindControl("CtrlQ1")
' mytextbox.ID = "txtbox1"
' myval.ControlToValidate = e.Item.Cells(3).Contols.Item(0).clientid
' myval.ControlToValidate = "txtbox1"
myval.ControlToValidate ="CtrlQ1"
myval.ErrorMessage = " Must have a valid date"
e.Item.Cells(3).Controls.Add(mylabel)
e.Item.Cells(3).Controls.Add(myval)
Thanks
Tegest
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
[Non-text portions of this message have been removed]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/