Hi together.
I'd like to add a button in an UltraWebGrid to access a new page. How can I do this?
Many greetings
Maddi1986
I added a button in the UltraWebGrid with the ColumnType.Button property but know I got a problem with the button event handler. Here is some code:
private void ShowAppointmentSuggestion(){
AppointmentSuggestionView.Bands[0].Columns.Add("Date", "Datum"); // AppointmentSuggestionView is the UltraWebGrid AppointmentSuggestionView.Bands[0].Columns.Add("Time", "Uhrzeit");AppointmentSuggestionView.Bands[0].Columns.Add("Request", "Anforderung");
UltraGridColumn bookingColumn = new UltraGridColumn("Booking", "Buchung", ColumnType.Button, "Booking");bookingColumn.CellButtonDisplay = CellButtonDisplay.Always;bookingColumn.Width = 145;AppointmentSuggestionView.Bands[0].Columns.Add(bookingColumn);
.... Add some data in the Grid
AppointmentSuggestionView.ClickCellButton += new ClickCellButtonEventHandler(AppointmentSuggestionView_ClickCellButton);
}
void AppointmentSuggestionView_ClickCellButton(object sender, CellEventArgs e)
{}
If I click on a button in the button column it throws a PostBack but the Method AppointmentSuggestionView_ClickCellButton will not be entered. Why not? Can somebody please help me.
The event handler is should be added somewhere where the event handler will always be hooked up. The handler is added when you hit your button, but hten on the postback, since the handler is not reattached, the event does not know how to get directed.
Add the handler in the form init, or add it at design time. It's not like it would be hit if you don't have buttons in your grid.