I have a gridview with 10+ columns and any number of rows based on the date being selected. The gridview looks like this:
There are several parameters that can be selected that generates this gridview. I am trying to implement an
event on the
column. I want to be able to click on individual weight tickets and the page will redirect to a different page that shows that weight ticket's details.
I've tried implementing the following:
e.Row.cells.Attribute["onClick"] = redirectFunction
That did not do anything. I am unable to click on the weight ticket.
I would really appreciate any help regarding this.
This is not asked of me, but I'd like to be able to add something else to this. The redirect is done like this:
Response.Redirect("~/pages/TicketDetails.aspx?wt=" + weightTicket + "&act=" + actionMethod +"&src=" + HttpContext.Current.Request.Url);
is what determines whether the
page allows editing. If the
is set to
, you cannot edit it. If it is set to
, you can. I want to be able to dynamically tell the redirect function that it is a view action or edit action.
It is possible if you can look at the
columns. If any one of them have
, then it is an
action. If they have a value that is not NA, then it is a view. This is just an additional request. I can always just open it as edit and not worry about all this, but it would be helpful if I could do this too.
Any help would be appreciated.
The line I've written in the question (my attempt) is just a pseudo-code. Here is the actual line in my program:
e.Row.Cells.Attributes["onClick"] = "dataCellClick(" + e.Row.Cells.ToString() + ", view;";
is the function I am calling which in turn does a redirect. I've tried not calling a function but calling the redirect function right here and that didn't work. So I tried this. The two parameters to the function call is
The gridview that is already in place is dynamic. By that, I mean:
This is what my designer view looks like for the page. The gridview is selected in the image. It does not have all the columns listed out one by one. It gets the columns AND the rows dynamically from a query.
So, these are all the event handler properties I have:
I can tell you this much though:
The following columns are always existent in the gridview:
- Load #
- Vendor Name
- Weight Ticket
- Vendor BOL
- Truck Gross
- Product Net
These columns are standard and in this order.