paging

yossikz

New member
paging

אני מנסה לבצע חלוקה לדפים ומקבל את השגיאה AllowCustomPaging must be true and VirtualItemCount must be set for a DataGrid with ID DataGrid1 when AllowPaging is set to true and the selected datasource does not implement ICollection. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: AllowCustomPaging must be true and VirtualItemCount must be set for a DataGrid with ID DataGrid1 when AllowPaging is set to true and the selected datasource does not implement ICollection. Source Error: Line 51: objDR = cmd.ExecuteReader Line 52: DataGrid1.DataSource = objDR Line 53: DataGrid1.DataBind() Line 54: End Function הטקסט בתוכנית הוא Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here DataGrid1.VirtualItemCount = 200 get_table() End Sub Private Function get_table() Dim MyConn As New System.Data.OleDb.OleDbConnection(conn.ConnectionString) conn.Open() Dim objDR As System.Data.OleDb.OleDbDataReader objDR = cmd.ExecuteReader DataGrid1.DataSource = objDR DataGrid1.DataBind() End Function Sub DataGrid1_PageIndexChanged(ByVal obj As Object, ByVal e As DataGridPageChangedEventArgs) DataGrid1.CurrentPageIndex = e.NewPageIndex DataGrid1.DataBind() End Sub <asp:DataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px" runat="server" AllowPaging="True" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" BackColor="White" OnPageIndexChanged="DataGrid1_PageIndexChanged" CellPadding="0" GridLines="Vertical" ForeColor="Black" SelectedIndex="0"> <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#000099"></SelectedItemStyle> <AlternatingItemStyle BackColor="#CCCCCC"></AlternatingItemStyle> <HeaderStyle Font-Bold="True" ForeColor="White" BackColor="Black"></HeaderStyle> <FooterStyle BackColor="#CCCCCC"></FooterStyle> <PagerStyle HorizontalAlign="Center" ForeColor="Black" BackColor="#999999" Mode="NumericPages"></PagerStyle> </asp:DataGrid></form>
 

icaesar

New member
כתוב שם בדיוק מה לעשות

בכל מקרה אני ממליץ לא להתעסק עם ה CustomPaging אלא רק עם Paging ו Sorting רגיל (מידע רב תוכל למצוא ב Google תחת מחרוזות החיפוש: datagrid paging, pagination וכו').
 

yossikz

New member
זה נכון אבל

האם יש אפשרות לחלוקה לדפים גם ב oledbdatareader
 

Admini

New member
אפשר

אבל ביד
 

yossikz

New member
עדכון טבלה דרך datagrid

את הודעת השגיאה אני מקבל בסביבת הסטודיו. בסביבת ה web matrux עטבד תקין איך יוצאים מזה ‏‏על הפעולה להשתמש בשאילתה הניתנת לעדכון. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.OleDb.OleDbException: ‏‏על הפעולה להשתמש בשאילתה הניתנת לעדכון. Source Error: Source File: c:\inetpub\wwwroot\WebApplication1\add_7.aspx.vb Line: 110 Stack Trace: [OleDbException (0x80004005): ‏‏על הפעולה להשתמש בשאילתה הניתנת לעדכון.]
 

yossikz

New member
למה ?

בסביבת web matrix זה עובד חלק. בסביבת הסטודיו אני מציג את הנתונים אבל לא מצליח לעדכן. מצ"ב קובץ TXT עם כל התוכנית
 

gilad g

New member
אני לא אתחיל לדבג את כל ה-100

שורות האלו שיש שם. והשגיאה לא קשורה בכלל לסביבה שאתה עובד. ניסית את הלינק שנתתי לך?
 

yossikz

New member
אין כוונה לדבג רק לראות את השגיאה

למה זה קורה איך ניתן לתקן
 

gilad g

New member
נתתי לך לינק

נכנסת אליו? ניסית לעשות את מה שכתוב?
 

yossikz

New member
עובד, אבל

חלק מהבעיה אכן תוקן ותודה. השאלה האחרונה ממשיכה להתקיים
 

yossikz

New member
שגיאה חדשה

אני מקבל הודעה שגיאה חדשה. אולי יש לזה קשר Server Error in '/' Application. --------------------------------------------------------------------- Cannot use a leading .. to exit above the top directory. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: Cannot use a leading .. to exit above the top directory. Source Error
 

yossikz

New member
תיקון ההגדרות

תקנתי את ההגדרות לפי הלינק הקודם. הבעיה נשארת איך ממשיכים.
 
למעלה