Howard Bash
asked on
DataGrid cell change detection
I am working with a web form that contains the DataGrid component. I added a calendar form that I launch to allow the user to specify the date value for a column on the grid. Well after some amount of noodling around, I am able to launch the calendar and have it set the value of a hidden field on the calling form to the selected date. How can I get the returned value loaded into the cell in question? I have an update command on the row and can grab the value and add it to the grid then, but that is really too late. Any thoughts about this would be appreciated.
ASKER
The code looks like it may get me there. Thanks. One question about it though. What is this Literal1 used for?
Thanks again this does look promising.
Thanks again this does look promising.
A literal control basically just returns static text to the page. When the page does its postback and opens up again, it will run this Javascript (which returns the date value and closes the popup). You could probably do RegisterStartupScript and accomplish the same thing.
ASKER
This seems odd. How does the javascript code get executed and why?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
'This code goes into the grid's itemdatabound event
Private Sub dgDAPS_ItemDataBound
Dim txtEdit As TextBox = CType(e.Item.FindControl("
txtEdit.Attributes.Add("on
End Sub
'This code will go in your calendar popup page. It will return the date value back to the text box that you clicked on in the datagrid.
Protected WithEvents Literal1 As System.Web.UI.WebControls.
Public Sub Calendar1_SelectionChanged
Dim script As String
script = "<script language='javascript'> " & "window.opener." & _
HttpContext.Current.Reques
Format(Calendar1.SelectedD
Literal1.Text = script
End Sub