User Profile & Activity

Douglas Badin Member
Page
of 11

Hi,

I had to modify OnBeforeUpdate to set selectLastRow = null;

    if(!retVal)
selectLastRow = rowObject.KeyValue;
else
selectLastRow = null;

I had to do a simlar thing for OnBeforeAdd to set newRowTemp = null;

    if(!retVal)
newRowTemp = rowObject.GetCells();
else
newRowTemp = null;

If there is a validation problem and subsequently it is corrected, these variables need to cleared.

Additionally, for fillNewRow, a check needs to be done for null because the column is not visible

	var newRowActivated = false;

	for (var i = 0; i < newRowCells.length; i++)
	{
		if (newRowCells[i] != null)
		{
			newRowCells[i].SetText(newRowTempCells[i].Text);
			newRowCells[i].SetValue(newRowTempCells[i].Value);

			if (!newRowActivated)
			{
				newRowCells[i].ActivateEdit();
				newRowActivated = true;
			}
		}
	}
Posted: May 13, 2010 12:58 PM

Hi,

Ok.

Thanks,

Hi,

I am using the Client-Side OnBeforeAdd and OnBeforeUpdate Events to validate the data entered.

For each event if I return false, the Add or Update does not Add or Update the database as expected.

 

SCENARIO 1:

After entering data on a new row and tabbing off the last editable coloumn, the OnBeforeAdd Event fires which returns false and focus always remains on the new row which is good

No problem here.

 

SCENARIO 2:

Ater udpating data on an existing row, when I tab off the last editable column in row the OnBeforeUpdate Event fires which returns false and focus goes to the next row if one is available.  If it is the last row, it remains on the last row.

How do I keep focus on the row being updated if there exists other rows after it after returning false from the OnBeforeUpdate Event?

 

SCENARIO 3:

After updating data on an existing, clicking on another row causes the OnBeforeUpdate Event to fire and focus goes to the row clicked on.

How do I keep focus on the row being updated after returning false from the OnBeforeUpdate Event?

 

SCENARIO 4:

After entering data in a new row, when I click on another row, the OnBeforeAdd Event is not fired.  Focus goes to the clicked row and all data entered in the new row is lost.

How do I keep focus on the new row and keep the data entered?

 

Thanks,

Doug

Hi,

I was trying to use the CustomAttributes in a comparison for validation since the WebCombo may not have been used for the Update.

In the Add scenario, the Client-Side OnAfterAdd is too late because based on it's value I may not want to Add the row.

I think I will need to use a combination of things to get a value for comparison. 

For Updates, I can use CustomAttributes that are populated in the Server-Side InitializeRow and Client-Side OnExitEditMode Events.

For Adds I could use Andi's suggestion, WebCombo.GetRows()[0].RowElement.cells[3].innerText, since the new row will be the last row that has used the WebCombo.

Unless you have a different idea?

Thanks,

Doug

Hi,

 

1. Is it possible to have more than one CustomAttributes?  If so how do I delimit them or add them?

 

 

2. How can I add and set the attribute Client-Side for new rows?

I am trying to set the attributes in the Client-Side OnExitEditMode with the following code:

editObject.cellElement.setAttribute("Phone", Phone_String)

This does not work if it is a new row and throws an error.  It works fine for an existing row.

 

 

3. Now that I have modified the attributes Client-Side, how do I access the modified CustomAtributes in the Server-Side AddRow an UpdateRow Events?

 

 

Thanks,

Doug

Hi,

I see what you say. 

In an Add Scenario, the user will have accessed the WebCombo and everything is fine.

In an Update Scenario, the user may not have accessed the WebCombo and the SelectedRow is residue from the previous WebCombo access.

Is there a way to Canel the Update Server-Side, say in the UpdateRow Event?

 

The other thought I had was to use HiddenDataMember for the WebGridColumn that contains the WebCombo and on the Client-Side OnExitEditMode modify the HiddenDataMember attribute.  Hopefully I can access the modified HiddenDataMember attribute in the Client-Side OnBeforeAdd and OnBefore Update Events to do a comparison.

Do you think it will work?

What is best?

Thanks,

 

Setting the WebGridColumn.DefaultValue worked in OnAfterInitialize

I was finally able to call the WebGridCell.SetForceNoEdit Method in OnAfterInitialize but it didn't stick.

I found this post and was able to get SetForceNoEdit to work in the SetForceNoEdit OnRowSelect.

http://www.intersoftpt.com/Community/WebGrid/Tab-ForceNoEdit/

Hi,

That does not cause the InitializeLayout or PrepareDataBinding to fire again.

Like I said before, I was already doing a RebindDataSource in the User Control's Page_PreRender.  Doing ClearCachedDataSource() before RebindDataSource did not help.

Any other thoughts?

Thanks,

Doug

In ASP.Net there is a Page Life Cycle.  On PostBacks, ViewState is loaded in the LoadViewState, after Initialization and before LoadPostbackData.

My understanding is the FlyPostBack is probably doing something like an XMLHttpRequest.

When FlyPostBackSettings PostInputControls or PostHiddenFields is set to true, I am guessing you have to Package up these values in your XMLHttpRequest call.  That means you have to Unpackage this data on the Server so the Control Values are available.

Since you have the customize the XMLHttpRequest to pass control Values to the Server, I am guessing you are not using the LoadViewState, but some other Customized Server Event to Unpackage the data.

What is the Event Sequence (Life Cycle) of an FlyPostBack and where is the Control Values associated with FlyPostBackSettings unpackaged on the Server?

What is the earliest that these FlyPostBackSettings Control Values are available Server Side on any FlyPostBack?  I am not necessarily talking about when used with a RenderControl ClientAction.  If you want to bring the RenderControl into the scenario I don't mean on that FlyPostBack it would on subsequent FlyPostBacks, just like with or without a RenderControl.

 

What is the earlist Server Side Event that I can get the value from the asp:TextBox that has been loaded by the FlyPostBack.

All times are GMT -5. The time now is 4:37 AM.
Previous Next