User Profile & Activity

Glenn Layaar Support
Page
of 99

In ExitEditMode, you could use the edit object parameter to determine the column that is being modified. Here is the snippet:

function WebGrid1_OnExitEditMode(ctrlId, tblName, editObj)
{
var grid = ISGetObject(ctrlId);

var colName = editObj.ToCellObject().Name;
}

In order to retrieve the sum value in the footer row, you will need to access the footer HTML element using method describe in Switching to new Client Side API article in the WebGrid documentation. Here is the code snippet, showing how to retrieve the footer of field "Quantity":

function getFooterValue()
{
var grid = ISGetObject("WebGrid1");

var tgtColName = "Quantity";
var tgt = 0;

var headerCells = grid.RootTable.GetElement(WG40.COLHEADER, WG40.HTMLDIV).getElementsByTagName("td");

for(var i = 0; i < headerCells.length; i++)
{
var headerCell = headerCells[i];
var colName = headerCell.getAttribute("ColName");

if(colName == tgtColName)
tgt = i;
}

var footerCells = grid.RootTable.GetElement(WG40.COLFOOTER, WG40.HTMLDIV).getElementsByTagName("tr")[1].getElementsByTagName("td");

var footerCellLabel = footerCells[tgt].innerHTML;
var footerCellText = grid.RootTable.Columns.GetNamedItem('Quantity').FooterText;

alert(footerCellLabel.replace(footerCellText, ""));

}


Posted: May 7, 2010 1:25 PM

Based on the snippet, I believe that you are trying to clear the selected row from WebGrid and Refresh all the data upon closing the WebDialogBox. If it is the case, you could try using this snippet in the RefreshGrid function:

function RefreshGrid(grid)
{
grid.ClearSelectedObject(true);
grid.RefreshAll();
}

You could use WebService to return the filtered data. However, WebGrid will only accept LINQ object or ISDataTable object as the return value.

The provide client binding sample with WebService has shown how to use WebService and LINQ object.

Here is the WebService method snippet using ISDataTable, the snippet will convert DataTable object into ISDataTable :

[WebMethod]
public Object GetData(DataSourceSelectArguments selectArguments)
{
SqlCommand retrieveComm = new SqlCommand();
retrieveComm.Connection = new SqlConnection(ConfigurationManager.ConnectionStrings["SqlNorthwindConnectionString"].ConnectionString);
retrieveComm.CommandText = "SELECT * FROM [Products]";

SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = retrieveComm;

DataTable dtTemp = new DataTable();
da.Fill(dtTemp);

ISDataTable isTable = DataTableConverter.ConvertFrom(dtTemp);
return isTable;

throw new InvalidOperationException("Unsupported operation type!");
}



In the WebGrid provided sample, CustomEditor_WebTextEditor.aspx, it is shown how to bind an image filename to image column WebGrid. Here is the image column definition snippet from the sample:

<ISWebGrid:WebGridColumn Caption="Image" DataMember="ProductImage" Name="ProductImage"
Width="100px" ColumnType="Image" ImageFormatString="images/products/{0}"
EditType="NoEdit">
</ISWebGrid:WebGridColumn>

Using template cell, you could use Bind keyword in the designer to bind the field, as shown in the article "Walkthrough: Configuring a WebGridColumn to use Templated Cell" in the WebGrid documentation.

Posted: May 7, 2010 11:08 AM

You couls use the Tooltip property in the Event and RecurringEvent to modify the displayed tooltip. One suggestions is to modify the tooltip during DataBound server side event handler. Here is the snippet, the tooltip is set to a static text:

protected void WebScheduler1_DataBound(object sender, ISNet.WebUI.WebScheduler.WebSchedulerDataBoundDataArgs e)
{
switch (e.Type)
{
case WebSchedulerObjectType.Event:
WebSchedulerEventBase evt = (WebSchedulerEventBase)e.DataObject;
evt.Tooltip = "Mod Event Tooltip";
break;
case WebSchedulerObjectType.RecurringEvent:
WebSchedulerRecurringEvent recEvt = (WebSchedulerRecurringEvent)e.DataObject;
recEvt.Tooltip = "Mod Recurring Event Tooltip";
break;
}
}


The error message will occur if the frozen column take all the available WebGrid space. However, my test also show that in XHTML doctype page the error message will be shown if the frozen column has already taken ~ 80-90% of the available space.


A bug report has been submitted to the developer. We will inform you if there is any update regarding this issue.

You could cancel the update row by returning false in the Update server side event handler. Here is the snippet:

protected void WebGrid1_UpdateRow(object sender, ISNet.WebUI.WebGrid.RowEventArgs e)
{
e.ReturnValue = false;
}

However afterward you will need to refresh the WebGrid to resynchronize the data.

WebGrid HiddenDataMember property will only be available for the field available in the WebGrid data source. In your scenario, you will need to use CustomAttributes property during InitializeRow server side event to hold the field data. In the shown example, the Phone field is buffered in the CustomerID cell element. Here is the InitializeRow server side event:

protected void WebGrid1_InitializeRow(object sender, ISNet.WebUI.WebGrid.RowEventArgs e)
{
//GetHiddenMember function will retrieve phone number based on CustomerID
e.Row.Cells.GetNamedItem("CustomerID").CustomAttributes =
"Phone = '" + GetHiddenMember(e.Row.Cells.GetNamedItem("CustomerID").Value.ToString()) + "'";
}

The snippet to retrieve the phone field during OnBeforeUpdate client side event:  

function WebGrid1_OnBeforeUpdate(controlId, tblName, rowObject) {
var grid = ISGetObject(controlId);

var rowObj = grid.GetSelectedObject().GetRowObject();
var cells = rowObj.GetCells();
var customer = cells.GetNamedItem("CustomerID");
var phone = customer.GetElement().attributes["Phone"].value;

//Process phone variable

return true;
}


Such function is not yet currently available in the WebScheduler. However, you could iterate the EventViews and AllDayEventViews property and check the start time and end time of each event to determine the event for a given date. This given date must be displayed in the WebScheduler view.

Here is the snippet:

function GetEvents()
{
var sched = ISGetObject("WebScheduler1");

var selDateEvent = new Array();

//Set date to 27 Feb 2008
var selDate = new Date(2008, 1, 27, 0, 0, 0, 0);
var selDateTicks = selDate.getTime();

var startTick = 0;
var endTick = 0;
var startDate = "";
var endDate = "";

var eventColl = [sched.EventViews, sched.AllDayEventViews];

for (var i = 0; i < eventColl.length; i++)
{
for (var j = 0; j < eventColl[i].length; j++)
{
var evt = eventColl[i][j];
startDate = evt.GetStartTime();
endDate = evt.GetEndTime();

startDate = new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate(), 0, 0, 0, 0);
endDate = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate(), 23, 59, 59, 999);

startTick = startDate.getTime();
endTick = endDate.getTime();

var diffStart = selDateTicks - startTick;
var diffEnd = endTick - selDateTicks;

if (diffStart >= 0 && diffEnd > 0)
selDateEvent.push(evt);
}
}

//Process the selDateEvent array
}



Attached is a WebScheduler provided sample which has been modified to have a work week from Sunday - Saturday and a HTML button to show the start date of the week and end date of the week.

In my environment, the function GetStartDateOfTheWeek and GetEndDateOfTheWeek has laready return the correct date.

Have you use the latest WebScheduler 3 and WebUI Framework 3 build?

Posted: May 5, 2010 10:41 AM

Based on the license manager in the screenshot, I could not see any mistake.

Are you using 64 bit OS? If you are using 64 bit OS you may need to run the ISRegx64 tool which come with WebUI Studio 2009 R2 SP1

All times are GMT -5. The time now is 3:34 AM.
Previous Next