Hello.
I have a ultrawebgrid with a cellButton column, I've tried diferent ways but cannot make the ClickCellButton to fire on server.
the button is like:
<igtbl:TemplatedColumn Type="Button" CellButtonDisplay="Always" Width="15px" Key="itemBTN" IsBound="false" AllowUpdate="No" BaseColumnName="Indicator" >
I tried with a template column, and the itemCommand is fired but , the button on it does not appear until the row is commited.
This is my code in DisplayLayout:
<DisplayLayout AllowColSizingDefault="Fixed" ScrollBar="Auto" BorderCollapseDefault="Separate"
Name="UltraWebGrid1" RowSelectorsDefault="yes" TableLayout="Fixed" Version="4.00"
UseFixedHeaders="True" AutoGenerateColumns="False" AllowDeleteDefault="Yes" AllowUpdateDefault="Yes" AllowAddNewDefault="Yes" FixedHeaderIndicatorDefault="None"
CellClickActionDefault ="Edit"
> I tried with xmlLoadOnDemand = Acumulative, but does not work. Please, help
>
I tried with xmlLoadOnDemand = Acumulative, but does not work.
Please, help
Hello,
You can use the server event OnClick and handle it. Please take a look at the code below:
ASPX:<Bands> <igtbl:UltraGridBand> <Columns> <igtbl:TemplatedColumn> <CellTemplate> <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /> </CellTemplate> </igtbl:TemplatedColumn>C#:protected void Button1_Click(object sender, EventArgs e) { Label1.Text = "change"; }
Hope this helps.
Super, this example is fine, but have one more problem, when I add a new row, the button in the template doesn't get visible. I have "rowadding" enabled.
Thanks for sharing your solution in public forums -- much appreciated. I am sure this will be useful to a lot of developers in the future.
Thanks again.
In case any one has this problem, the situation is tha for clickCellbutton event to fire the new row has to be added to the rows collection in the grid. When I add a new row pressing the "Add" from the addnewbox, the row is added to the collection, so the event is fired.
When I use the property "AddNewRow" visible=" true", the new rows can be added with a simple press on TAB key in the last column. That new row is not in the rows collection, so the event does not fire. But that is the way I would like It works. So what I did was change the property "AddNewRow" to visible="false", and use a code like the next one to add the new row for myself:
function grid_AfterExitEditModeHandler(gridName, cellId) { var grid = igtbl_getGridById(gridName); var oCell = igtbl_getCellById(cellId); var row = oCell.getRow();
// puede ser asi: if (oCell.Column.Key == "Precio" && row.getIndex() == grid.Rows.length - 1) { if (oCell.Column.Key == "Precio" && row.getNextRow() == null) { igtbl_addNew(gridName, 0); }
Something very interesting, with de button column, when I am working on the new row the event ClickCellButton does not work, but when the row is commited it works fine. So, the problem is on the new row, not only with button column, but also with de template column with a button on it.