User Profile & Activity

Dhaval Vaghani Member

Hello,

I have now used the "onmousedownevent" with the custom object attribute. But now the problem is that the grid no longer recognizes that row as being edited, after I change the status for the checkbox. As a result , "OnTheFlyPostBack" does not happen for row updates, which would otherwise happen as soon as I navigate away from the row.

The code I am using is

maExcludeCell.CustomObjectAttributes = "onmousedown = 'return CheckForMultipleExclude(this);'";

 

function CheckForMultipleExclude(data)

{

var grid = ISGetObject("WebGridMain");  

if (data.checked) {data.checked =

data.checked = false;

}

else { data.checked = true;

}

var exclude = data.checked; var proceed = confirm("Would you like to apply your 'Exclude' changes to all three subjects ? Click 'OK' to modify all, or 'Cancel' to modify just the current subject."); if (proceed)

{

grid.AddInput("Operation", "MultipleExclude");

"Operation", "MultipleExclude"); if (exclude) {

grid.AddInput("Exclude", "True");

}

"Exclude", "True");

}

else {

grid.AddInput("Exclude", "False");

}

grid.SetStatus1(

"Exclude", "False");

}

grid.SetStatus1(
"Updating .... ");

grid.SendCustomRequest();

//Takes the current status bar message and assigns it to tooltip setTimeout("return SetGridStatusBarToolTip();", 0);

}

return true;

}

Posted: May 6, 2010 6:35 AM

Hello,

Is there any news regarding this bug. We are approaching the release, and would like it to be sorted. Can you please inform me on the status of this bug ?

 

Thanks

Dhaval

Posted: April 27, 2010 12:57 PM

Hi,

Thank you for your reply.

I am trying the code to clear the row selection stated above. Can you please tell me in which client side event should I be adding this code. I tried to call the above function "ClearSelection()" during "OnAfterResponseProcess" event, which clears the selection, but it reappears after the page finishes loading. When I put an alert in the end of the "ClearSelection()" method, the selection is cleared, but as soon as the page finishes loading it appears back.

FYI: I am using "RestoreRowSelection = "ALL" 

Thanks and appreciate your help

Regards

Dhaval.

 

 

Posted: April 26, 2010 10:18 AM

Hello,

 

Please find attached the video of the way to recreate the bug i mentioned in the file IMG_0139.Zip . I am using the latest hot fix, and using the code present in the file  BindWebValueListtoISDataSource.aspx.zip in the above post.

Thanks for your help and appreciate your quick reply.

Thanks

Dhaval.

var grid = ISGetObject("WebGrid1");
grid.GetChanges()[0].Row.NewProperty = grid.GetChanges()[index].Row.GetCells().GetNamedItem("[ColumnName]")

 

Doing the above action during the OnBeforeRequest client side event does not help. I need to have access to the entire corresponding WebGridRow object on Server side when doing Batch Update.

 

FYI: When i do your above specified code and try to access the .NewProperty before the BatchUpdate event is triggered for the server side update, it still gives me NULL.

 

Please help

Hello,

Thanks for your reply. I cannot disable the paging feature as there are close to 5000 records in my grid, which I cannot show in a single page.

For your other question, I need to access each cell data of the row that has been modified. I was hoping to use the ".Row" property of the WebGridRowChange class, as that would allow me to implement batch update to my existing code with having to do any changes.

 

Kindly let me know a fix for this. Thanks

The following is the designer code in .aspx file

<%@ Page Language="C#" MasterPageFile="DefaultMaster.master" AutoEventWireup="true" CodeFile="SendingCustomRequest.aspx.cs" Inherits="cs_WebGrid_SendingCustomRequest" Title="Sending Custom Request" %> <%@ Register Assembly="ISNet.WebUI.ISDataSource, Version=1.0.1500.1, Culture=neutral, PublicKeyToken=c4184ef0d326354b" Namespace="ISNet.WebUI.DataSource" TagPrefix="ISDataSource" %> <%@ Register Assembly="ISNet.WebUI.WebGrid" Namespace="ISNet.WebUI.WebGrid" TagPrefix="ISWebGrid" %> <asp:Content ID="Content1" ContentPlaceHolderID="content" runat="server"> <script type="text/javascript"> function WebGrid1_OnRowSelect(gridId, tblName, rowIndex, rowElm)

{

var grid = ISGetObject("WebGrid1"); var key = rowElm.keyValue;

{

grid.AddInput("key",key);

grid.SendCustomRequest();

}

"key",key);

grid.SendCustomRequest();

}

return true;

}

// This function is invoked when the custom request is about to be made. function wgPrepareCustomAction(grid, xmlr, name)

{

grid.SetStatus1(
"Filtering Orders data..."); return true;

}

// This function is invoked after a response for the custom request is received. function wgCustomActionResponse(grid, xmlrp)

{

grid.SetStatus1(
"Ready."); return true;

}

</script> <table class="text"> <tr> <td> <ISWebGrid:WebGrid ID="WebGrid1" runat="server" Height="300px" UseDefaultStyle="True" Width="100%" DataMember="Customers" DataSourceID="ISDataSource1" OnInitializePostBack="WebGrid1_InitializePostBack"> <RootTable Caption="Customers" DataKeyField="CustomerID" DataMember="Customers"> <Columns> <ISWebGrid:WebGridColumn Caption="CustomerID" DataMember="CustomerID" Name="CustomerID" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="CompanyName" DataMember="CompanyName" Name="CompanyName" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="ContactName" DataMember="ContactName" Name="ContactName" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="ContactTitle" DataMember="ContactTitle" Name="ContactTitle" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Address" DataMember="Address" Name="Address" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="City" DataMember="City" Name="City" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Country" DataMember="Country" Name="Country" Width="100px"> </ISWebGrid:WebGridColumn> </Columns> </RootTable> <LayoutSettings> <ClientSideEvents OnRowSelect="WebGrid1_OnRowSelect" /> </LayoutSettings> <FlyPostBackSettings PostInputControls="True" /> </ISWebGrid:WebGrid> </td> </tr> <tr> <td> KeyValue from WebGrid1 to be reflected in WebGrid2 : <asp:TextBox ID="TextBox1" CssClass="text" runat="server"></asp:TextBox> </td> </tr> <tr> <td> <ISWebGrid:WebGrid ID="WebGrid2" runat="server" Height="300px" UseDefaultStyle="True" Width="100%" DataMember="Orders" DataSourceID="ISDataSource1"> <RootTable Caption="Customers" DataKeyField="OrderID" DataMember="Orders"> <Columns> <ISWebGrid:WebGridColumn Caption="OrderID" DataMember="OrderID" DataType="System.Int32" Name="OrderID" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="CustomerID" DataMember="CustomerID" Name="CustomerID" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="OrderDate" DataMember="OrderDate" DataType="System.DateTime" Name="OrderDate" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="RequiredDate" DataMember="RequiredDate" DataType="System.DateTime" Name="RequiredDate" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="ShippedDate" DataMember="ShippedDate" DataType="System.DateTime" Name="ShippedDate" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="ShipName" DataMember="ShipName" Name="ShipName" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="ShipAddress" DataMember="ShipAddress" Name="ShipAddress" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="ShipCity" DataMember="ShipCity" Name="ShipCity" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="ShipCountry" DataMember="ShipCountry" Name="ShipCountry" Width="100px"> </ISWebGrid:WebGridColumn> </Columns> </RootTable> <FlyPostBackSettings PostInputControls="True" /> </ISWebGrid:WebGrid> </td> </tr> </table> <ISDataSource:ISDataSource ID="ISDataSource1" runat="server" SchemaName="dsNorthwind_LoadOnDemand"> <Tables> <ISDataSource:ISDataSourceTable ConflictDetection="CompareAllValues" DeleteMethod="Delete" InsertMethod="Insert" OldValuesParameterFormatString="Original_{0}" SelectMethod="GetData" TableName="Customers" TypeName="dsNorthwind_LoadOnDemandTableAdapters.CustomersTableAdapter" UpdateMethod="Update"> <UpdateParameters> <asp:Parameter Name="CustomerID" Type="String" /> <asp:Parameter Name="CompanyName" Type="String" /> <asp:Parameter Name="ContactName" Type="String" /> <asp:Parameter Name="ContactTitle" Type="String" /> <asp:Parameter Name="Address" Type="String" /> <asp:Parameter Name="City" Type="String" /> <asp:Parameter Name="Region" Type="String" /> <asp:Parameter Name="PostalCode" Type="String" /> <asp:Parameter Name="Country" Type="String" /> <asp:Parameter Name="Phone" Type="String" /> <asp:Parameter Name="Fax" Type="String" /> <asp:Parameter Name="Original_CustomerID" Type="String" /> <asp:Parameter Name="Original_CompanyName" Type="String" /> <asp:Parameter Name="Original_ContactName" Type="String" /> <asp:Parameter Name="Original_ContactTitle" Type="String" /> <asp:Parameter Name="Original_Address" Type="String" /> <asp:Parameter Name="Original_City" Type="String" /> <asp:Parameter Name="Original_Region" Type="String" /> <asp:Parameter Name="Original_PostalCode" Type="String" /> <asp:Parameter Name="Original_Country" Type="String" /> <asp:Parameter Name="Original_Phone" Type="String" /> <asp:Parameter Name="Original_Fax" Type="String" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="CustomerID" Type="String" /> <asp:Parameter Name="CompanyName" Type="String" /> <asp:Parameter Name="ContactName" Type="String" /> <asp:Parameter Name="ContactTitle" Type="String" /> <asp:Parameter Name="Address" Type="String" /> <asp:Parameter Name="City" Type="String" /> <asp:Parameter Name="Region" Type="String" /> <asp:Parameter Name="PostalCode" Type="String" /> <asp:Parameter Name="Country" Type="String" /> <asp:Parameter Name="Phone" Type="String" /> <asp:Parameter Name="Fax" Type="String" /> </InsertParameters> <DeleteParameters> <asp:Parameter Name="Original_CustomerID" Type="String" /> <asp:Parameter Name="Original_CompanyName" Type="String" /> <asp:Parameter Name="Original_ContactName" Type="String" /> <asp:Parameter Name="Original_ContactTitle" Type="String" /> <asp:Parameter Name="Original_Address" Type="String" /> <asp:Parameter Name="Original_City" Type="String" /> <asp:Parameter Name="Original_Region" Type="String" /> <asp:Parameter Name="Original_PostalCode" Type="String" /> <asp:Parameter Name="Original_Country" Type="String" /> <asp:Parameter Name="Original_Phone" Type="String" /> <asp:Parameter Name="Original_Fax" Type="String" /> </DeleteParameters> </ISDataSource:ISDataSourceTable> <ISDataSource:ISDataSourceTable ConflictDetection="CompareAllValues" DeleteMethod="Delete" InsertMethod="Insert" OldValuesParameterFormatString="Original_{0}" SelectMethod="GetDataBy" TableName="Orders" TypeName="dsNorthwind_LoadOnDemandTableAdapters.OrdersTableAdapter" UpdateMethod="Update"> <UpdateParameters> <asp:Parameter Name="CustomerID" Type="String" /> <asp:Parameter Name="EmployeeID" Type="Int32" /> <asp:Parameter Name="OrderDate" Type="DateTime" /> <asp:Parameter Name="RequiredDate" Type="DateTime" /> <asp:Parameter Name="ShippedDate" Type="DateTime" /> <asp:Parameter Name="ShipVia" Type="Int32" /> <asp:Parameter Name="Freight" Type="Decimal" /> <asp:Parameter Name="ShipName" Type="String" /> <asp:Parameter Name="ShipAddress" Type="String" /> <asp:Parameter Name="ShipCity" Type="String" /> <asp:Parameter Name="ShipRegion" Type="String" /> <asp:Parameter Name="ShipPostalCode" Type="String" /> <asp:Parameter Name="ShipCountry" Type="String" /> <asp:Parameter Name="Original_OrderID" Type="Int32" /> <asp:Parameter Name="Original_CustomerID" Type="String" /> <asp:Parameter Name="Original_EmployeeID" Type="Int32" /> <asp:Parameter Name="Original_OrderDate" Type="DateTime" /> <asp:Parameter Name="Original_RequiredDate" Type="DateTime" /> <asp:Parameter Name="Original_ShippedDate" Type="DateTime" /> <asp:Parameter Name="Original_ShipVia" Type="Int32" /> <asp:Parameter Name="Original_Freight" Type="Decimal" /> <asp:Parameter Name="Original_ShipName" Type="String" /> <asp:Parameter Name="Original_ShipAddress" Type="String" /> <asp:Parameter Name="Original_ShipCity" Type="String" /> <asp:Parameter Name="Original_ShipRegion" Type="String" /> <asp:Parameter Name="Original_ShipPostalCode" Type="String" /> <asp:Parameter Name="Original_ShipCountry" Type="String" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="CustomerID" Type="String" /> <asp:Parameter Name="EmployeeID" Type="Int32" /> <asp:Parameter Name="OrderDate" Type="DateTime" /> <asp:Parameter Name="RequiredDate" Type="DateTime" /> <asp:Parameter Name="ShippedDate" Type="DateTime" /> <asp:Parameter Name="ShipVia" Type="Int32" /> <asp:Parameter Name="Freight" Type="Decimal" /> <asp:Parameter Name="ShipName" Type="String" /> <asp:Parameter Name="ShipAddress" Type="String" /> <asp:Parameter Name="ShipCity" Type="String" /> <asp:Parameter Name="ShipRegion" Type="String" /> <asp:Parameter Name="ShipPostalCode" Type="String" /> <asp:Parameter Name="ShipCountry" Type="String" /> </InsertParameters> <DeleteParameters> <asp:Parameter Name="Original_OrderID" Type="Int32" /> <asp:Parameter Name="Original_CustomerID" Type="String" /> <asp:Parameter Name="Original_EmployeeID" Type="Int32" /> <asp:Parameter Name="Original_OrderDate" Type="DateTime" /> <asp:Parameter Name="Original_RequiredDate" Type="DateTime" /> <asp:Parameter Name="Original_ShippedDate" Type="DateTime" /> <asp:Parameter Name="Original_ShipVia" Type="Int32" /> <asp:Parameter Name="Original_Freight" Type="Decimal" /> <asp:Parameter Name="Original_ShipName" Type="String" /> <asp:Parameter Name="Original_ShipAddress" Type="String" /> <asp:Parameter Name="Original_ShipCity" Type="String" /> <asp:Parameter Name="Original_ShipRegion" Type="String" /> <asp:Parameter Name="Original_ShipPostalCode" Type="String" /> <asp:Parameter Name="Original_ShipCountry" Type="String" /> </DeleteParameters> <SelectParameters> <asp:ControlParameter ControlID="TextBox1" Name="CustomerID" PropertyName="Text" Type="String" /> </SelectParameters> </ISDataSource:ISDataSourceTable> </Tables> </ISDataSource:ISDataSource> <asp:Button ID = "test" runat="server" onclick="test_Click" Text="PostBack" />

</asp:Content>

asp:Content>

 

The following is the code behind

 

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.IO;

public partial class cs_WebGrid_SendingCustomRequest : System.Web.UI.Page

partial class cs_WebGrid_SendingCustomRequest : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

}

protected void WebGrid1_InitializePostBack(object sender, ISNet.WebUI.WebGrid.PostbackEventArgs e)

{

if (e.Action == ISNet.WebUI.WebGrid.PostBackAction.Custom)

{

TextBox1.Text = Request[
"key"] as string; // retrieved data specified at client side WebGrid1.ClientAction.RenderControl(TextBox1); // refresh specified control

OutputFile();

}

}

private void OutputFile()

{

HttpResponse currentResponse = HttpContext.Current.Response;

currentResponse.Clear();

currentResponse.ClearHeaders();

currentResponse.ClearContent();

FileStream fs = new FileStream("C:\\ReportBuilderHelpFile.doc", FileMode.Open); byte[] result = new byte[fs.Length]; int offset = 0; int length = Convert.ToInt32(fs.Length); while (length > 0)

{

int read = fs.Read(result, offset, length);

length = length - read;

offset = offset + read;

}

//Attach pdf file to HttpResponse

currentResponse.AppendHeader("Content-Disposition", "attachment; filename=" + "C:\\ReportBuilderHelpFile.doc");

currentResponse.ContentType = "application/octet-stream; name=ReportBuilderHelpFile.doc";

currentResponse.BinaryWrite(result);

"Content-Disposition", "attachment; filename=" + "C:\\ReportBuilderHelpFile.doc");

currentResponse.ContentType = "application/octet-stream; name=ReportBuilderHelpFile.doc";

currentResponse.BinaryWrite(result);

"application/octet-stream; name=ReportBuilderHelpFile.doc";

currentResponse.BinaryWrite(result);

//currentResponse.End();

currentResponse.Flush();

HttpContext.Current.ApplicationInstance.CompleteRequest();

}

protected void test_Click(object sender, EventArgs e)

{

OutputFile();

}

}

 

As you can see, in the code if I click on the full post back button the code works fine, but not in the case of ONTheFlyPostBack

All times are GMT -5. The time now is 10:45 PM.
Previous Next