开发者

jquery gridview not posting back - vs2010

Original post with great solution

i then added a save button outside of grid view and capture the events in the code behind as such

DataKey key;
            foreach (GridViewRow rows in myGV.Rows)
            {
                key = myGV.DataKeys[rows.RowIndex];
                //Get Date 1
                var Date1 = ((TextBox)rows.FindControl("Date1")).Text;
                //Get Date 2
                var Date2 = ((TextBox)rows.Find开发者_StackOverflowControl("Date2")).Text;

            }

however date1 and date 2 are empty if my text box that call the datepicker has its TEXT' property = "".

If i set the TEXT property to defauult value and change date using date picker then I only get the default value back but not the new value choosen via date picker RESOLVED: in page_load i wasnt checking for (!IsPostback)

How do I close this question?


RESOLVED: In page_load I was binding my grid view so each time on button click the page_load would be called nd the default values were set which were picked up by button onclick event. So in page_load i placed my gridview binding code withing

 if (!IsPostBack)
{

..

gridview.DataBind();
}

and things seem to work

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜