Thanks for the suggestion. I did stick the BindData() in the !isPostBack
block. In the process, I learned that my columns were sorting only because
BindData() was called everytime. Since I moved BindData() into the
!IsPostBack block, my columns don't sort when I click on a column header. I
learned that TemplateColumn does not generate the sort event.
Does anyone have any helpful information to sort when using TemplateColumn?
I need to be able to sort using the TemplateColumn. Please help.
Thanks
TheJackOfAll
:
Cor is right. Move BindData into your if statement and then call it as
needed in the click event for the column sort.
Then, when the user clicks select, you won't run into a BindData call along
the way.
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik
Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
Cor,
Here is my problem. I have a datagrid with sort columns. One of those
columns is a checkbox column. And, I have a button regular button with
postback.
My page_load() looks something like this:
void page_load(..)
{
If (!IsPostBack)
{
Session["SortColumn"] = "AgentID";
Session["SortOrder"] = "Asc";
}
BindData();
}
When I click on a column header, it sorts by the sort order. So, I need
to
call BindData(). When I click on a button called "Select", I don't need
to
call BindData() and display the checkboxes that are checked prior to
pressing
the button. I do have the button handler, but the Page_Load is called
before
the handler gets called.
I need to determine if the original event is caused by the button or
something else in order to prevent the datagrid binding data every time.
Your input is appreciated.
J
:
Hi
The loadevent is called everytime a page is loaded or/and is postedback
There is no need to check in that page the handling of the button event,
that you can do in the button click event it self (when you do not know
that, than message back)
For to prevent that unwanted actions are taken on postback is the
IsPostback
property, very easy to use and well desctripted on this page.
http://msdn.microsoft.com/library/d.../frlrfsystemwebuipageclassispostbacktopic.asp
I hope this helps?
Merry Christmas
Cor