עבור לתוכן

FormView שעושה הכל חוץ מלעדכן

Featured Replies

פורסם

אחרי כל הסיבוכים שלי עם ASP.NET הזה הצלחתי לעשות מה שרציתי (בערך).

אבל עכשיו יש לי בעיה די מוזרה...

יש לי FormView שלא מוכן לעדכן את המסד נתונים. על המחשב שלי הוא מעדכן והכל בסדר, איך שאני מעלה הכל לשרת הוא "שוכח" איך מעדכנים...

אני יכול להכניס נתונים, אני יכול להציג, אבל אני לא יכול לערוך...

<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/notes.mdb" SelectCommand="SELECT * FROM [notes] WHERE ([ID] = ?)" InsertCommand="INSERT INTO [notes] ([title], [content], [active]) VALUES (?, ?, ?)" OldValuesParameterFormatString="original_{0}" UpdateCommand="UPDATE [notes] SET [title] = ?, [content] = ?, [active] = ? WHERE [ID] = ?" DeleteCommand="DELETE FROM [notes] WHERE [ID] = ?">
<UpdateParameters>
<asp:Parameter Name="title" Type="String" />
<asp:Parameter Name="content" Type="String" />
<asp:Parameter Name="active" Type="Boolean" />
<asp:Parameter Name="original_ID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="title" Type="String" />
<asp:Parameter Name="content" Type="String" />
<asp:Parameter Name="active" Type="Boolean" />
</InsertParameters>
<DeleteParameters>
<asp:Parameter Name="original_ID" Type="Int32" />
</DeleteParameters>
<SelectParameters>
<asp:QueryStringParameter Name="ID" QueryStringField="id" Type="Int32" />
</SelectParameters>
</asp:AccessDataSource>
       
<br />

<br />
<asp:FormView ID="FormView2" runat="server" AllowPaging="True" CellPadding="4" DataKeyNames="ID"
DataSourceID="AccessDataSource1" ForeColor="#333333">
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<EditItemTemplate>
<strong> <br />
קוד עמוד:</strong><span style="color:Red;">
* קוד עמוד של ההודעה, לא לשנות</span><br />
<asp:Label ID="IDLabel1" runat="server" Text='<%# Eval("ID") %>'></asp:Label><br />
<br />
<strong>
כותרת:</strong><span style="color:Red;">
* ההודעה שתופיע בהודעות הרצות
</span>
<br />
<asp:TextBox ID="titleTextBox" runat="server" Text='<%# Bind("title") %>'>
</asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="titleTextBox" ValidationGroup="edit1" Display="Dynamic" runat="server" ErrorMessage="לא הוכנסה כותרת" SetFocusOnError="True"></asp:RequiredFieldValidator><br />


<strong>תוכן:</strong><span style="color:Red;">
* תוכן המודעה שתוצג בלחיצה על המודעה.<br />
* כדי שבהודעה עצמה תיהיה ירידת שורה יש לכתוב בסוף השורה- "<br>" (ללא המרכאות)<br />
</span>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="contentTextBox" ValidationGroup="edit1" Display="Dynamic" runat="server" ErrorMessage="לא הוכנס תוכן" SetFocusOnError="True"></asp:RequiredFieldValidator><br />
<asp:TextBox ID="contentTextBox" runat="server" Text='<%# Bind("content") %>' Columns="70" Rows="20" TextMode="MultiLine"></asp:TextBox><br />
<br />
<strong>
מופעל:</strong><span style="color:Red;">
* אם לא מסומן, ההודעה לא תופיע בדף הראשי
</span>
<br />
<asp:CheckBox ID="activeCheckBox" runat="server" Checked='<%# Bind("active") %>' /><br />
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
Text="עדכן" ValidationGroup="edit1"></asp:LinkButton>
<asp:LinkButton ID="CancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
Text="ביטול" ValidationGroup="edit1"></asp:LinkButton>
</EditItemTemplate>
<InsertItemTemplate>
<strong>
כותרת:</strong><span style="color:Red;">
* ההודעה שתופיע בהודעות הרצות
</span>
<br />
<asp:TextBox ID="titleTextBox" runat="server" Text='<%# Bind("title") %>'></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator1" ValidationGroup="insert1" ControlToValidate="titleTextBox" Display="Dynamic" runat="server" ErrorMessage="לא הוכנסה כותרת" SetFocusOnError="True"></asp:RequiredFieldValidator><br />

<strong>תוכן:</strong><span style="color:Red;">
* תוכן המודעה שתוצג בלחיצה על המודעה.<br />
* כדי שבהודעה עצמה תיהיה ירידת שורה יש לכתוב בסוף השורה- "<br>" (ללא המרכאות)<br />
</span>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" ValidationGroup="insert1" ControlToValidate="contentTextBox" Display="Dynamic" runat="server" ErrorMessage="לא הוכנס תוכן" SetFocusOnError="True"></asp:RequiredFieldValidator><br />
<asp:TextBox ID="contentTextBox" runat="server" Text='<%# Bind("content") %>' Columns="70" Rows="20" TextMode="MultiLine"></asp:TextBox><br />
<br />

<strong>
מופעל:</strong><span style="color:Red;">
* אם לא מסומן, ההודעה לא תופיע בדף הראשי
</span>
<br />
<asp:CheckBox ID="activeCheckBox" runat="server" Checked='<%# Bind("active") %>' /><br />
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
Text="הוסף"></asp:LinkButton>
<asp:LinkButton ID="CancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
Text="ביטול"></asp:LinkButton>
</InsertItemTemplate>
<ItemTemplate>
<strong>קוד עמוד:</strong><span style="color:Red;">
* קוד עמוד של ההודעה, לא לשנות</span><br />
<asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>'></asp:Label><br />
<strong>
כותרת:</strong><span style="color:Red;">
* ההודעה שתופיע בהודעות הרצות
</span>
<br />
<asp:Label ID="titleLabel" runat="server" Text='<%# Bind("title") %>'></asp:Label><br />
<strong>תוכן:</strong><span style="color:Red;">
* תוכן המודעה שתוצג בלחיצה על המודעה.<br /></span><br />
<br />
<asp:Label ID="contentLabel" runat="server" Text='<%# Bind("content") %>'></asp:Label><br />
<strong>
מופעל:</strong><span style="color:Red;">
* אם לא מסומן, ההודעה לא תופיע בדף הראשי
</span>
<br />
<asp:CheckBox ID="activeCheckBox" runat="server" Checked='<%# Bind("active") %>'
Enabled="false" /><br />
<asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"
Text="עריכה"></asp:LinkButton>
<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete"
Text="מחיקה" Visible="False"></asp:LinkButton>
<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New"
Text="מודעה חדשה"></asp:LinkButton>
</ItemTemplate>
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<EmptyDataTemplate>
קוד עמוד
לא נמצא<br />
<asp:LinkButton runat="server" ID="NewButton" CausesValidation="false" CommandName="New" Text="הודעה חדשה"></asp:LinkButton>
</EmptyDataTemplate>
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#999999" />
</asp:FormView>

אני אשמח לקצת עזרה...

תודה

פורסם
  • מחבר

up

עכשיו הוא בכלל לא עושה כלום על השרת...

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים