how can I make the Row edit template pop up after clicking on the Add New Box without having to click on the new empty row?
If I try to do this in the UltraWebGrid1_AfterRowInsertHandler event using row.editRow() method it tries to update the record.
Hi Robert,
I have a simple ASP.NET application with a WebGrid bound to a SqlDataSource and I am handling the AfterRowInsertHandler client side event.
Here is the code in that event handler:
function UltraWebGrid1_AfterRowInsertHandler(gridName, rowId, index){
//Add code to handle your event here.
igtbl_getRowById(rowId).editRow();
}
Once I click on the AddNew box, a new row is inserted and immediately, I see the RowEditTemplate open
Off the top of my head you should check:
1. Are you handling any server side events that will fire when you add a new row?
2. Are you causing any postbacks to occur?
Anything that causes a postback will stop the RowEditTemplate from showing.
I have similar need. I have a button placed outside the Grid. Now when I click the button, it should open the RET (RowEditTemplate).
Can you share what properties need to set up in UGV(UltraGirdView) to pop up the RET ? I just need to popup the RET.
This is my button
input value="New" type="button" id="abc" runat="server" onclick="test()"
This is my function to get the RET
function test()
{
alert(
"Open RET");
row = igtbl_addNew(grid, 0);
row.editRow();
I never did figure a solution to this problem. No matter how simple a solution the row edit template user control always disappears when I click on the add new box. I tried setting a variable and capturing this in the template close event to cancel that event but that only caused other problems.
I have a simple form with a UltraWebGrid and a SqlDataSource. I wire them up together and add the following client side event. :
function UltraWebGrid1_AfterRowInsertHandler(gridName, rowId, index){ igtbl_getRowById(rowId).editRow();}
In the server side I add the following:
Protected Sub UltraWebGrid1_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.LayoutEventArgs) Handles UltraWebGrid1.InitializeLayout UltraWebGrid1.DisplayLayout.AddNewBox.Hidden = False UltraWebGrid1.DisplayLayout.AddNewRowDefault.Visible = Infragistics.WebUI.UltraWebGrid.AddNewRowVisible.No UltraWebGrid1.DisplayLayout.AllowAddNewDefault = Infragistics.WebUI.UltraWebGrid.AllowAddNew.Yes UltraWebGrid1.DisplayLayout.AllowUpdateDefault = Infragistics.WebUI.UltraWebGrid.AllowUpdate.RowTemplateOnly End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim template As ITemplate template = Page.LoadTemplate("RTS_CFR_Maint.ascx") UltraWebGrid1.Bands(0).RowEditTemplate = template ' Add an extra column for a button to allow template editing UltraWebGrid1.Columns.Insert(0, "Edit") UltraWebGrid1.Columns(0).Type = ColumnType.Custom UltraWebGrid1.Columns(0).Width = New Unit(75) Me.UltraWebGrid1.DisplayLayout.Bands(0).Columns(0).Header.Caption = "" End Sub
I run the application and only firing an edit event retains the row edit template. Clicking "add new" fires the event to close the row edit template after the row has been added to the grid on the client side.
You mentioned possibly causing a post back... I have no other events other than above in my simple demo so I am confused as to what is happening here.
Thanks....