Problem in date picker in edit template of the gridview
-
Hi In edit mode of the gridview, I have provide date picker. For this I am opening a new page containing the calender using java script: window.open('CalendarPopUp.aspx?textbox=tbxSetDate','cal','width=250,height=225,left=270,top=180') But I am unable to take the selected date back to the parent page. When I am trying to access the textbox of the current row in gridview's rowcommand like: TextBox tbxSetDate= (TextBox)(GridView2.Rows[Int32.Parse(e.CommandArgument.ToString())].Cells[2].FindControl("TextBox2")); I am getting null instead of the textbox object. Any idea here? Regards, Rocky
Rakesh
-
Hi In edit mode of the gridview, I have provide date picker. For this I am opening a new page containing the calender using java script: window.open('CalendarPopUp.aspx?textbox=tbxSetDate','cal','width=250,height=225,left=270,top=180') But I am unable to take the selected date back to the parent page. When I am trying to access the textbox of the current row in gridview's rowcommand like: TextBox tbxSetDate= (TextBox)(GridView2.Rows[Int32.Parse(e.CommandArgument.ToString())].Cells[2].FindControl("TextBox2")); I am getting null instead of the textbox object. Any idea here? Regards, Rocky
Rakesh
Hi Rakesh, When you go into edit mode the e.CommandArgument is not working some of the times. Therefore it is likely you cannot find your textbox in that row. I use the following to get the correct row number. GridViewRow row = (GridViewRow)((Control)e.CommandSource).Parent.Parent you can try it and see. regards blooper