User Profile & Activity

Frank Bruce Member
Page
of 15
Posted: September 27, 2010 10:12 PM

I think that  I find the problem.
Because I use $,not $,it cause wrong.
Anyway,webgrid does not support '$'.

WebGrid version:V7.0.7200
Framework version:3.0.5000.755
my OS: winserver2003+VS2008

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="dataFormatDemo.aspx.cs" Inherits="dataFormatDemo" %>

<%@ Register Assembly="ISNet.WebUI.WebGrid" Namespace="ISNet.WebUI.WebGrid" TagPrefix="ISWebGrid" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head runat="server">
    <title>dataFormatDemo </title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <ISWebGrid:WebGrid ID="WebGrid1" runat="server" Height="280px" DefaultStyleMode="Win7" UseDefaultStyle="True"
                Width="800px" DataSourceID="AccessDataSource1">
                <LayoutSettings AllowAddNew="Yes" AllowDelete="Yes" AllowEdit="Yes" NewRowLostFocusAction="AlwaysUpdate">
                </LayoutSettings>
                <RootTable DataKeyField="vouid">
                    <Columns>
                        <ISWebGrid:WebGridColumn Caption="商品名称" DataMember="商品名称" Name="商品名称">
                        </ISWebGrid:WebGridColumn>
                      <%-- anyway,if Use DataFormatString="$",it has no problem!--%>
                       <ISWebGrid:WebGridColumn Caption="价格范围" DataType="System.Decimal" DataFormatString="$##,###.00"  DataMember="价格范围" Name="价格范围" 
                            >
                        </ISWebGrid:WebGridColumn>
                        <ISWebGrid:WebGridColumn Caption="vouid" DataMember="vouid" Name="vouid" 
                            DataType="System.Int32">
                        </ISWebGrid:WebGridColumn>              
                        </Columns>
                </RootTable>
            </ISWebGrid:WebGrid>
            <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
                DataFile="~/App_Data/Product.mdb" 
                DeleteCommand="DELETE FROM [ProductInfo] WHERE [vouid] = ?" 
                InsertCommand="INSERT INTO [ProductInfo] ([商品名称], [价格范围], [vouid]) VALUES (?, ?, ?)" 
                SelectCommand="SELECT [商品名称], [价格范围], [vouid] FROM [ProductInfo]" 
                
                UpdateCommand="UPDATE [ProductInfo] SET [商品名称] = ?, [价格范围] = ? WHERE [vouid] = ?">
                <DeleteParameters>
                    <asp:Parameter Name="vouid" Type="Int32" />
                </DeleteParameters>
                <UpdateParameters>
                    <asp:Parameter Name="商品名称" Type="String" />
                    <asp:Parameter Name="价格范围" Type="Decimal" />
                    <asp:Parameter Name="vouid" Type="Int32" />
                </UpdateParameters>
                <InsertParameters>
                    <asp:Parameter Name="商品名称" Type="String" />
                    <asp:Parameter Name="价格范围" Type="Decimal" />
                    <asp:Parameter Name="vouid" Type="Int32" />
                </InsertParameters>
            </asp:AccessDataSource>
        </div>
    </form>
</body>
</html>
Posted: September 26, 2010 11:54 PM

BatchUpdate can achieve my basic aim,but that is not my goal__Because batchUpdate  runs more slowly than  "WebGrid1_DeleteRow"!
Maybe it has no way to avoid the popup infor(“Please wait while WebGrid is in progress processing request…”) when I delete multi_Rows by WebGrid1_DeleteRow event  on Serverside !

                                                                                                               Thank you all the same Yudi_

I use "Template Column ",bind the data of database!
but I can not update this  "Template Column ",can you tell me how to update  "Template Column "
???

  <ISWebGrid:WebGridColumn ColumnType=Template Caption="LGname" Name="LGname"  EditType="TextBox" NewRowEditType="TextBox">
                 <CellTemplate>
                     <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("LGname") %>'>'></asp:TextBox>
                  </CellTemplate>                   
                </ISWebGrid:WebGridColumn>
Posted: September 24, 2010 9:23 PM

I am sorry  that I have known the way to delete rows below by client way(or call js code on severside),but I want to know how to to avoid the popup infor when I delete multi_Rows by deleterow event  on Serverside ????(please pay attention to the question ! thanks)

//delete rows :one wayfunction deleteMutRows() 
{ 
    var grid = ISGetObject("WebGrid1"); 
    var checkedRows = grid.RootTable.GetCheckedRows(); 
    if(checkedRows.length==0)
    {
   alert(' please select row !');
    }
    else
      {
    for(i=0;i<=checkedRows.length - 1;i++) 
    { 
        row = grid.RootTable.ToRowObject(checkedRows[i]); 
        grid.XmlHttp.Asynchronous = false; 
        row.Delete(); 
     } 
       }   
} 

//delete rows :the other wayfunction deleteRows()
{
var grid = ISGetObject("WebGrid1");
var i=0;
 var maxRow=5;//the count of Deleting rows
 var updateProcess = setInterval (function ()    
   { if (!grid.IsInProgress && i < maxRow)        
   {    

  var rows = grid.RootTable.GetCheckedRows(); 
  var row = grid.RootTable.ToRowObject(rows[i])
   row .Delete();
    i++;         
}        
    if (i >= maxRow) 
          
    {
     clearInterval(updateProcess);              
    updateProcess = null;        
    } }, 1);

}
Posted: September 20, 2010 3:00 AM

thankyou

Posted: September 19, 2010 1:40 AM

Can anyone help me? thanks

Posted: September 16, 2010 1:59 AM

thank you Handy Surya:

 when I use 100% property instead of AutoHeight or AutoWidth,The problem was solved!

thank you anyway!

Posted: September 9, 2010 2:14 AM

Although it is a littie stranger,it solve my problem!

thank you Handy Surya

Posted: September 8, 2010 9:08 PM

thank you  Handy:

you are so kind to me~

Posted: September 7, 2010 9:09 PM

I have update  query~

i want TO update the any cell  that I have select by dbclick cell !

How to do?

could you please show me a demo !thank you !

All times are GMT -5. The time now is 6:37 PM.
Previous Next