Access Textbox datetime value in Edittable data grid

Posted by Toashish80 under ASP.NET on 11/23/2009 | Views : 2151 | Status : [Member] | Replies : 9
I have a dynamic editable datagrid with a date textbox along with normal numeric textbox. I am selecting the date using the datetime picker control and when I am clicking on the button, the control goes to the previous page and the data entered in the child screen is displayed in the parent screen. The problem here is that when I am trying to access the data from previous child page into the main page then I am not able to access the date textbox value except other controls. Could you please provide any means by which I can access the date textbox value.




Responses

Posted by: Vuyiswamb on: 11/23/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
How many Controls are you having problem accessing the values from the previous page ?

Thank you for posting at dotnetfunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Toashish80, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Toashish80 on: 11/23/2009 [Member] Starter

Up
0
Down
I am having the problem in accessing the datetime texbox only. I am able to access the values for other textboxes.

Toashish80, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 11/23/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Why dont you add it to a Session ?

Thank you for posting at Dotnetfunda
[Administrator]

Toashish80, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Toashish80 on: 11/23/2009 [Member] Starter

Up
0
Down
I tried adding the value to the session variable. I had deubugged the code and found that when on click of the button, the value for the datetexbox is coming as empty string.

Toashish80, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 11/23/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
can you post a code that Store the Value to the Session ?

Thank you for posting at Dotnetfunda
[Administrator]

Toashish80, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Toashish80 on: 11/23/2009 [Member] Starter

Up
0
Down
Dim ctr As Integer = 0
While ctr < dgrSubjectInvg.Items.Count - 1
If Equals(CType(dgrSubjectInvg.Items(ctr).Cells(2).Controls(0), Label).Text, "Investigation Date") Then
Session("InvestigationDate") = CType(dgrSubjectInvg.Items(ctr).Cells(8).Controls(0), TextBox).Text
End If
ctr += 1
End While

Toashish80, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 11/23/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
is dgrSubjectInvg a Gridview ?

Thank you for posting at Dotnetfunda
[Administrator]

Toashish80, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Toashish80 on: 11/23/2009 [Member] Starter

Up
0
Down
No..Its a datagrid not a gridview

Toashish80, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 11/23/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
change your code to this


For Each row As GridViewRow In dgrSubjectInvg.Rows

Dim ddl As DropDownList = DirectCast(row.Cells(8).FindControl("MyDDLname"), DropDownList)


Session("InvestigationDate") = ddl.SelectedValue
Next


and tell me it its working

Thank you for posting at Dotnetfunda


Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Toashish80, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response