- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是代码。我现在也在代码隐藏中遇到错误,即变量已经存在并且方法具有相同的签名,但我无法在后面的代码中的任何地方找到这些重复项。
.ASPX
<%@ Page Title="Mijn oefeningen" Language="VB" MasterPageFile="~/main.master" AutoEventWireup="false" Inherits="Fitness2.exercises" Codebehind="exercises.aspx.vb" %>
<%@ MasterType VirtualPath="~/main.master" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CPHBigBanner" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="CPHQuickSearch" Runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="CPHCenter" Runat="Server">
<asp:Label ID="lblStatus" runat="server" />
<div class="section">
<div class="action">
<asp:Button ID="btnAddNew" runat="server" Text="Nieuwe oefening aanmaken" />
</div>
</div>
<div class="section">
<asp:GridView DataKeyNames="id" Width="100%" ID="gvExercises" runat="server" GridLines="Horizontal" CellPadding="10" AllowSorting="true" AllowPaging="True" PageSize="50" AutoGenerateColumns="False" >
<PagerSettings Mode="NumericFirstLast" Position="Bottom" />
<PagerStyle CssClass="gridpager" HorizontalAlign="Center" />
<RowStyle CssClass="gv_even" Height="20" />
<AlternatingRowStyle CssClass="gv_odd" />
<HeaderStyle CssClass="gv_header" />
<Columns>
<asp:CommandField ShowSelectButton="True" SelectText="Bekijk"/>
<asp:TemplateField>
<ItemTemplate>
<asp:linkButton runat="server" CausesValidation="false" ID="Edit" Text="Bewerk" CommandName="EditItem" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField SortExpression="title" HeaderText="Oefening naam">
<ItemTemplate>
<asp:Label ID="lblTitle" runat="server" Text='<%# Eval("title") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField SortExpression="category" HeaderText="Categorie">
<ItemTemplate>
<asp:Label ID="category" runat="server" Text='<%# Eval("category") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton runat="server" ImageUrl="/images/delete.png" CausesValidation="false" ID="Delete" OnClientClick="javascript:return confirm('Weet je zeker dat je dit item wilt verwijderen?');" ToolTip="Verwijder" CommandName="Delete" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="odsExercises" runat="server" SortParameterName="sortExpression" SelectMethod="GetExercisesPagedSorted" InsertMethod="InsertExercise" DeleteMethod="DeleteExerciseById" SelectCountMethod="GetExercisesCount" TypeName="ExerciseBLL" EnablePaging="true">
<DeleteParameters>
<asp:Parameter Name="Id" Type="Int32" />
</DeleteParameters>
</asp:ObjectDataSource>
<asp:DetailsView GridLines="None" AutoGenerateRows="False" DataKeyNames="id" DataSourceID="odsdvExercises" ID="dvExercises" Width="100%" runat="server">
<Fields>
<asp:CommandField ButtonType="Link" ValidationGroup="Exercises" ControlStyle-CssClass="link" EditText="Item bewerken" NewText="Nieuw item aanmaken" UpdateText="Opslaan" InsertText="Opslaan" ShowEditButton="True" CancelText="Annuleren" ShowInsertButton="true" />
<asp:TemplateField HeaderText="ID">
<ItemTemplate>
<%#Eval("id")%>
</ItemTemplate>
<EditItemTemplate>
<%#Eval("id")%>
</EditItemTemplate>
<InsertItemTemplate>
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Oefening naam *" HeaderStyle-Font-Bold="true">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("title") %>'/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="title" Width="400" MaxLength="150" CssClass="textbox" runat="server" Text='<%# Bind("title") %>'/>
<asp:RequiredFieldValidator ID="ReqdfguiredF43ieldValidator1" ValidationGroup="Exercises" ControlToValidate="title" runat="server" ErrorMessage="*" Display="Dynamic"/>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="title" Width="400" MaxLength="150" CssClass="textbox" runat="server" Text=""/>
<asp:RequiredFieldValidator ID="Requdf1giredF43ieldVagfglidator1" ValidationGroup="Exercises" ControlToValidate="title" runat="server" ErrorMessage="*" Display="Dynamic"/>
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Doelstelling">
<ItemTemplate>
<asp:Literal ID="Lafgdfdbel1c" runat="server" Text='<%# Eval("goal").tostring %>'/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="goal" MaxLength="150" Width="400" CssClass="textbox" runat="server" Text='<%# Bind("goal") %>'/>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="goal" MaxLength="150" Width="400" CssClass="textbox" runat="server" Text=""/>
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Tempo">
<ItemTemplate>
<asp:Literal ID="Lafdgdfdbel1c" runat="server" Text='<%# Eval("tempo").tostring %>'/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="tempo" MaxLength="50" Width="400" CssClass="textbox" runat="server" Text='<%# Bind("tempo") %>'/>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="tempo" MaxLength="50" Width="400" CssClass="textbox" runat="server" Text=""/>
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Omschrijving">
<ItemTemplate>
<asp:Literal ID="Lafdgdfdbel1c" runat="server" Text='<%# Eval("description").tostring %>'/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="description" TextMode="MultiLine" Rows="3" Columns="50" CssClass="textbox" runat="server" Text='<%# Bind("description") %>'/>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="description" TextMode="MultiLine" Rows="3" Columns="50" Width="400" CssClass="textbox" runat="server" Text=""/>
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Aantal sets">
<ItemTemplate>
<asp:Literal ID="La1fgdfdbel1c" runat="server" Text='<%# Eval("sets").tostring %>'/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="sets" MaxLength="2" Width="50" CssClass="textbox" runat="server" Text='<%# Bind("sets") %>'/>
<asp:RegularExpressionValidator ControlToValidate="sets" ValidationGroup="Exercises" ID="RegularExpressionValidator7" runat="server" ValidationExpression="[0-9]+" ErrorMessage="Ongeldig getal" />
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="sets" MaxLength="2" Width="50" CssClass="textbox" runat="server" Text=""/>
<asp:RegularExpressionValidator ControlToValidate="sets" ValidationGroup="Exercises" ID="RegularExpressionValidator7" runat="server" ValidationExpression="[0-9]+" ErrorMessage="Ongeldig getal" />
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Minimum herhalingen">
<ItemTemplate>
<asp:Literal ID="La1f3gdfdbel1c" runat="server" Text='<%# Eval("reprange_min").tostring %>'/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="reprange_min" MaxLength="2" Width="50" CssClass="textbox" runat="server" Text='<%# Bind("reprange_min") %>'/>
<asp:RegularExpressionValidator ControlToValidate="reprange_min" ValidationGroup="Exercises" ID="RegularExpresfsionValidator7" runat="server" ValidationExpression="[0-9]+" ErrorMessage="Ongeldig getal" />
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="reprange_min" MaxLength="2" Width="50" CssClass="textbox" runat="server" Text=""/>
<asp:RegularExpressionValidator ControlToValidate="reprange_min" ValidationGroup="Exercises" ID="RegularExpresfsionValidator7" runat="server" ValidationExpression="[0-9]+" ErrorMessage="Ongeldig getal" />
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Maxmimum herhalingen">
<ItemTemplate>
<asp:Literal ID="La1f3gdfdb6el1c" runat="server" Text='<%# Eval("reprange_max").tostring %>'/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="reprange_max" MaxLength="2" Width="50" CssClass="textbox" runat="server" Text='<%# Bind("reprange_max") %>'/>
<asp:RegularExpressionValidator ControlToValidate="reprange_max" ValidationGroup="Exercises" ID="RegularExspressionValidator7" runat="server" ValidationExpression="[0-9]+" ErrorMessage="Ongeldig getal" />
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="reprange_max" MaxLength="2" Width="50" CssClass="textbox" runat="server" Text=""/>
<asp:RegularExpressionValidator ControlToValidate="reprange_max" ValidationGroup="Exercises" ID="RegularsExpressionValidator7" runat="server" ValidationExpression="[0-9]+" ErrorMessage="Ongeldig getal" />
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Minuten">
<ItemTemplate>
<asp:Literal ID="La11f3gdfdb6el1c" runat="server" Text='<%# Eval("minutes").tostring %>'/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="minutes" MaxLength="3" Width="50" CssClass="textbox" runat="server" Text='<%# Bind("minutes") %>'/>
<asp:RegularExpressionValidator ControlToValidate="minutes" ValidationGroup="Exercises" ID="RegularExpressionValidator8" runat="server" ValidationExpression="[0-9]+" ErrorMessage="Ongeldig getal" />
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="minutes" MaxLength="3" Width="50" CssClass="textbox" runat="server" Text=""/>
<asp:RegularExpressionValidator ControlToValidate="minutes" ValidationGroup="Exercises" ID="RegularExpressionValidator8" runat="server" ValidationExpression="[0-9]+" ErrorMessage="Ongeldig getal" />
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="YouTube link">
<ItemTemplate>
<asp:Literal ID="La11f3gdfd2b6el1c" runat="server" Text='<%# Fitness2.GlobalFunctions.GetVideoEmbed(Eval("youtube").tostring) %>'/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="youtube" MaxLength="50" Width="400" CssClass="textbox" runat="server" Text='<%# Bind("youtube") %>'/>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="youtube" MaxLength="2" Width="400" CssClass="textbox" runat="server" Text=""/>
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Categorie" HeaderStyle-VerticalAlign="Top">
<ItemTemplate>
<asp:Label ID="Label1b" runat="server" Text='<%# Bind("category") %>'/>
</ItemTemplate>
<EditItemTemplate>
<table>
<tr>
<td>Selecteer bestaande categorie:</td>
<td>
<asp:DropDownList ID="ddlcategory" SelectedValue='<%# Bind("category") %>' DataSourceID="sqldsCategories" DataTextField="title" DataValueField="title" runat="server">
</asp:DropDownList>
</td>
</tr>
<tr>
<td>of maak een nieuwe categorie aan:</td>
<td>
<asp:TextBox ID="category" Width="200" MaxLength="50" CssClass="textbox" runat="server" />
<asp:RequiredFieldValidator ID="RequirebbdF43ieldValidator1" ValidationGroup="tasks" ControlToValidate="category" runat="server" ErrorMessage="*" Display="Dynamic"/>
</td>
</tr>
</table>
</EditItemTemplate>
<InsertItemTemplate>
<table>
<tr>
<td>Selecteer bestaande categorie:</td>
<td>
<asp:DropDownList ID="ddlcategory" DataSourceID="sqldsCategories" DataTextField="title" DataValueField="title" runat="server">
</asp:DropDownList>
</td>
</tr>
<tr>
<td>of maak een nieuwe categorie aan:</td>
<td>
<asp:TextBox ID="category" Width="200" MaxLength="50" CssClass="textbox" runat="server" />
<asp:RequiredFieldValidator ID="RequirebbdF43ieldValidator1" ValidationGroup="tasks" ControlToValidate="category" runat="server" ErrorMessage="*" Display="Dynamic"/>
</td>
</tr>
</table>
</InsertItemTemplate>
</asp:TemplateField>
</Fields>
</asp:DetailsView>
<asp:ObjectDataSource ID="odsdvExercises" TypeName="ExerciseBLL" SelectMethod="GetExerciseById" InsertMethod="InsertExercise" UpdateMethod="UpdateExercise" runat="server">
<SelectParameters>
<asp:ControlParameter ControlID="gvExercises" Name="id" PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:SqlDataSource ID="sqldsCategories" ConnectionString="<%$ConnectionStrings:conn1 %>" runat="server"></asp:SqlDataSource>
</div>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="CPHRight" Runat="Server">
</asp:Content>
Imports Fitness2.GlobalFunctions
Imports System.Drawing
Imports System.IO
Partial Class exercises
Inherits System.Web.UI.Page
Private _userid As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
_userid = GetFieldFromSession(Session, "//root/user/userid")
If Not Page.IsPostBack Then
BindExercises()
End If
End Sub
'**************** TASKS ****************
Protected Sub BindExercises()
odsExercises.SelectParameters.Clear()
gvExercises.DataSourceID = "odsExercises"
odsExercises.SelectParameters.Add("maximumRows", gvExercises.PageSize)
odsExercises.SelectParameters.Add("startRowIndex", gvExercises.PageIndex)
odsExercises.SelectParameters.Add("sortExpression", odsExercises.SortParameterName)
odsExercises.SelectParameters.Add("userid", _userid)
'gvExercises.DataBind()
End Sub
Protected Sub lbtnInsert_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim Title As String = Trim(CType(dvExercises.FindControl("title"), TextBox).Text)
Dim userid As String = _userid
Dim goal As String = Trim(CType(dvExercises.FindControl("goal"), TextBox).Text)
Dim tempo As String = Trim(CType(dvExercises.FindControl("tempo"), TextBox).Text)
Dim description As String = Trim(CType(dvExercises.FindControl("description"), TextBox).Text)
If description.Length > 4000 Then description = description.Substring(0, 4000)
Dim sets As Integer
Int32.TryParse(Trim(CType(dvExercises.FindControl("sets"), TextBox).Text), sets)
Dim reprange_min As Integer
Int32.TryParse(Trim(CType(dvExercises.FindControl("reprange_min"), TextBox).Text), reprange_min)
Dim reprange_max As Integer
Int32.TryParse(Trim(CType(dvExercises.FindControl("reprange_max"), TextBox).Text), reprange_max)
Dim minutes As Integer
Int32.TryParse(Trim(CType(dvExercises.FindControl("minutes"), TextBox).Text), minutes)
Dim youtube As String = Trim(CType(dvExercises.FindControl("youtube"), TextBox).Text)
'Dim ispublic As Boolean = CType(dvExercises.FindControl("ispublic"), CheckBox).Checked
Dim category As String = Trim(CType(dvExercises.FindControl("category"), TextBox).Text)
Dim categorydropdown As DropDownList = CType(dvExercises.FindControl("ddlcategory"), DropDownList)
If category = "" Then 'user wants to create new category
If categorydropdown.Items.Count = 0 Then
lblStatus.Text = GetStatus("Maak aub eerst een categorie aan", True)
Else
If categorydropdown.SelectedIndex <> -1 Then category = CType(dvExercises.FindControl("ddlcategory"), DropDownList).Text
End If
End If
Dim TA As New fitnessTableAdapters.exercisesTableAdapter
Dim returnval As Integer
TA.InsertExercise(New Guid(userid), Title, category, goal, tempo, description, sets, reprange_min, reprange_max, minutes, youtube, "", False, 0, returnval)
If returnval > 0 Then
Session("exerciseId") = returnval
gvExercises.DataBind()
lblStatus.Text = GetStatus("Oefening toegevoegd", False)
Else
lblStatus.Text = GetStatus("Whoops", True)
End If
End Sub
Protected Sub dvExercises_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewInsertEventArgs) Handles dvExercises.ItemInserting
Dim Title As String = Trim(CType(dvExercises.FindControl("title"), TextBox).Text)
Dim userid As String = _userid
Dim goal As String = Trim(CType(dvExercises.FindControl("goal"), TextBox).Text)
Dim tempo As String = Trim(CType(dvExercises.FindControl("tempo"), TextBox).Text)
Dim description As String = Trim(CType(dvExercises.FindControl("description"), TextBox).Text)
If description.Length > 4000 Then description = description.Substring(0, 4000)
Dim sets As Integer
Int32.TryParse(Trim(CType(dvExercises.FindControl("sets"), TextBox).Text), sets)
Dim reprange_min As Integer
Int32.TryParse(Trim(CType(dvExercises.FindControl("reprange_min"), TextBox).Text), reprange_min)
Dim reprange_max As Integer
Int32.TryParse(Trim(CType(dvExercises.FindControl("reprange_max"), TextBox).Text), reprange_max)
Dim minutes As Integer
Int32.TryParse(Trim(CType(dvExercises.FindControl("minutes"), TextBox).Text), minutes)
Dim youtube As String = Trim(CType(dvExercises.FindControl("youtube"), TextBox).Text)
'Dim ispublic As Boolean = CType(dvExercises.FindControl("ispublic"), CheckBox).Checked
Dim category As String = Trim(CType(dvExercises.FindControl("category"), TextBox).Text)
Dim categorydropdown As DropDownList = CType(dvExercises.FindControl("ddlcategory"), DropDownList)
If category = "" Then 'user wants to create new category
If categorydropdown.Items.Count = 0 Then
lblStatus.Text = GetStatus("Maak aub eerst een categorie aan", True)
Else
If categorydropdown.SelectedIndex <> -1 Then category = CType(dvExercises.FindControl("ddlcategory"), DropDownList).Text
End If
End If
Dim TA As New fitnessTableAdapters.exercisesTableAdapter
Dim returnval As Integer
TA.InsertExercise(New Guid(userid), Title, category, goal, tempo, description, sets, reprange_min, reprange_max, minutes, youtube, "", False, 0, returnval)
If returnval > 0 Then
Session("exerciseId") = returnval
gvExercises.DataBind()
lblStatus.Text = GetStatus("Oefening toegevoegd", False)
Else
lblStatus.Text = GetStatus("Whoops", True)
End If
e.Cancel = True
End Sub
Protected Sub odsdvExercises_Inserted(ByVal sender As Object, ByVal e As ObjectDataSourceStatusEventArgs) Handles odsdvExercises.Inserted
gvExercises.DataBind()
End Sub
Protected Sub odsdvExercises_Updated(ByVal sender As Object, ByVal e As ObjectDataSourceStatusEventArgs) Handles odsdvExercises.Updated
gvExercises.DataBind()
End Sub
Protected Sub dvExercises_ItemUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewUpdateEventArgs) Handles dvExercises.ItemUpdating
Dim ID As Integer = CInt(dvExercises.DataKey.Value)
'retrieve controls
Dim Title As String = Trim(CType(dvExercises.FindControl("title"), TextBox).Text)
Dim userid As String = _userid
Dim goal As String = Trim(CType(dvExercises.FindControl("goal"), TextBox).Text)
Dim tempo As String = Trim(CType(dvExercises.FindControl("tempo"), TextBox).Text)
Dim description As String = Trim(CType(dvExercises.FindControl("description"), TextBox).Text)
If description.Length > 4000 Then description = description.Substring(0, 4000)
Dim sets As Integer
Int32.TryParse(Trim(CType(dvExercises.FindControl("sets"), TextBox).Text), sets)
Dim reprange_min As Integer
Int32.TryParse(Trim(CType(dvExercises.FindControl("reprange_min"), TextBox).Text), reprange_min)
Dim reprange_max As Integer
Int32.TryParse(Trim(CType(dvExercises.FindControl("reprange_max"), TextBox).Text), reprange_max)
Dim minutes As Integer
Int32.TryParse(Trim(CType(dvExercises.FindControl("minutes"), TextBox).Text), minutes)
Dim youtube As String = Trim(CType(dvExercises.FindControl("youtube"), TextBox).Text)
'Dim ispublic As Boolean = CType(dvExercises.FindControl("ispublic"), CheckBox).Checked
Dim category As String = Trim(CType(dvExercises.FindControl("category"), TextBox).Text)
Dim categorydropdown As Integer = CType(dvExercises.FindControl("ddlcategory"), DropDownList).SelectedIndex
If categorydropdown <> -1 Then category = CType(dvExercises.FindControl("ddlcategory"), DropDownList).Text
Dim TA As New fitnessTableAdapters.exercisesTableAdapter
Dim dt As fitness.exercisesDataTable = TA.GetExerciseById(ID)
Dim returnval As Integer = TA.Update(New Guid(userid), Title, category, goal, tempo, description, sets, reprange_min, reprange_max, minutes, youtube, dt(0).locpath.ToString, False, DateTime.Now, ID)
Select Case returnval
Case 0
lblStatus.Text = GetStatus("Whoops", True)
Case 1
gvExercises.DataBind()
lblStatus.Text = GetStatus("Item opgeslagen", False)
End Select
e.Cancel = True
End Sub
Protected Sub gvExercises_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvExercises.RowDataBound
Dim gvr As GridViewRow = e.Row
If gvr.RowType = DataControlRowType.DataRow Then
Dim imgBtn As ImageButton
imgBtn = CType(e.Row.FindControl("Delete"), ImageButton)
imgBtn.CommandArgument = gvr.RowIndex.ToString
Dim lnkBtn As LinkButton
lnkBtn = CType(e.Row.FindControl("Edit"), LinkButton)
lnkBtn.CommandArgument = gvr.RowIndex.ToString
End If
End Sub
Protected Sub gvExercises_OnRowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) Handles gvExercises.RowCommand
If e.CommandName = "DeleteEvent" Then
Dim index As Integer = Convert.ToInt32(e.CommandArgument)
Dim data As DataKey = gvExercises.DataKeys(index)
Dim objectId As Integer = data.Values("id")
odsExercises.DeleteParameters.Clear()
odsExercises.DeleteParameters.Add("id", objectId)
odsExercises.Delete()
End If
If e.CommandName = "EditItem" Then
Dim index As Integer = Convert.ToInt32(e.CommandArgument)
Dim data As DataKey = gvExercises.DataKeys(index)
Dim objectId As Integer = data.Values("id")
'floran
ViewState("id") = objectId.ToString
BindDetailsView()
'gvExercises.SelectedValue
'dvExercises.ChangeMode(DetailsViewMode.Edit)
End If
End Sub
Protected Sub dvExercises_ItemCommand(ByVal sender As Object, ByVal e As DetailsViewCommandEventArgs) Handles dvExercises.ItemCommand
End Sub
Protected Sub BindDetailsView()
Dim TA As New fitnessTableAdapters.exercisesTableAdapter
dvExercises.DataSourceID = ""
dvExercises.DataSource = TA.GetExerciseById(ViewState("id")) ' customer.FetchByCustomerType(ViewState("CustomerType").ToString())
dvExercises.DataBind()
dvExercises.ChangeMode(DetailsViewMode.Edit)
End Sub
Protected Sub btnAddNew_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAddNew.Click
dvExercises.ChangeMode(DetailsViewMode.Insert)
End Sub
Protected Sub gvExercises_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles gvExercises.SelectedIndexChanged
If gvExercises.SelectedDataKey IsNot Nothing Then
Session("exerciseId") = CInt(gvExercises.SelectedDataKey.Value)
'ReportError("Session(exerciseId)", Session("exerciseId").ToString)
End If
End Sub
End Class
最佳答案
我没有保留这两种解决方案,而是将网站项目转换为 WAP。
您需要将网站项目中 app_code 文件夹中的所有内容移动到单独的类库中,或者直接将它们包含在 WAP 中(可能没有 app_code 文件夹,因为它具有特殊意义),在这种情况下它们将是编译成主要的 WAP 程序集。
您可能必须使用命名空间等才能使其正常工作,但影响应该很小。主要区别(和好处)是代码是在编译时构建的,您的源代码 (*.cs) 没有部署到服务器。
另请注意,在 VS 中,有一个上下文菜单选项可将网站项目实体转换为 Web 应用程序实体。这将创建 WAP 所需的 .designer.cs 文件,并在解决方案资源管理器中组织这些文件 - .aspx、.cs 和 .designer.cs 文件将显示为可扩展节点。
Here's an excellent article on MSDN covering the conversion process .
一旦您运行了 WAP,添加服务就像 right click - add new item...
一样简单。
关于wcf - 在我的 Web 应用程序项目中重用来自网站项目的代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8670294/
我正在通过 labrepl 工作,我看到了一些遵循此模式的代码: ;; Pattern (apply #(apply f %&) coll) ;; Concrete example user=> (a
我从未向应用商店提交过应用,但我会在不久的将来提交。 到目前为止,我对为 iPhone 而非 iPad 进行设计感到很自在。 我了解,通过将通用PAID 应用放到应用商店,客户只需支付一次就可以同时使
我有一个应用程序,它使用不同的 Facebook 应用程序(2 个不同的 AppID)在 Facebook 上发布并显示它是“通过 iPhone”/“通过 iPad”。 当 Facebook 应用程序
我有一个要求,我们必须通过将网站源文件保存在本地 iOS 应用程序中来在 iOS 应用程序 Webview 中运行网站。 Angular 需要服务器来运行应用程序,但由于我们将文件保存在本地,我们无法
所以我有一个单页客户端应用程序。 正常流程: 应用程序 -> OAuth2 服务器 -> 应用程序 我们有自己的 OAuth2 服务器,因此人们可以登录应用程序并获取与用户实体关联的 access_t
假设我有一个安装在用户设备上的 Android 应用程序 A,我的应用程序有一个 AppWidget,我们可以让其他 Android 开发人员在其中以每次安装成本为基础发布他们的应用程序推广广告。因此
Secrets of the JavaScript Ninja中有一个例子它提供了以下代码来绕过 JavaScript 的 Math.min() 函数,该函数需要一个可变长度列表。 Example:
当我分别将数组和对象传递给 function.apply() 时,我得到 NaN 的 o/p,但是当我传递对象和数组时,我得到一个数字。为什么会发生这种情况? 由于数组也被视为对象,为什么我无法使用它
CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界. 这篇CFSDN的博客文章ASP转换格林威治时间函数DateDiff()应用由作者收集整理,如果你
我正在将列表传递给 map并且想要返回一个带有合并名称的 data.frame 对象。 例如: library(tidyverse) library(broom) mtcars %>% spl
我有一个非常基本的问题,但我不知道如何实现它:我有一个返回数据框,其中每个工具的返回值是按行排列的: tmp<-as.data.frame(t(data.frame(a=rnorm(250,0,1)
我正在使用我的 FB 应用创建群组并邀请用户加入我的应用群组,第一次一切正常。当我尝试创建另一个组时,出现以下错误: {"(OAuthException - #4009) (#4009) 在有更多用户
我们正在开发一款类似于“会说话的本”应用程序的 child 应用程序。它包含大量用于交互式动画的 JPEG 图像序列。 问题是动画在 iPad Air 上播放正常,但在 iPad 2 上播放缓慢或滞后
我关注 clojure 一段时间了,它的一些功能非常令人兴奋(持久数据结构、函数式方法、不可变状态)。然而,由于我仍在学习,我想了解如何在实际场景中应用,证明其好处,然后演化并应用于更复杂的问题。即,
我开发了一个仅使用挪威语的应用程序。该应用程序不使用本地化,因为它应该仅以一种语言(挪威语)显示。但是,我已在 Info.plist 文件中将“本地化 native 开发区域”设置为“no”。我还使用
读完 Anthony's response 后上a style-related parser question ,我试图说服自己编写单体解析器仍然可以相当紧凑。 所以而不是 reference ::
multicore 库中是否有类似 sapply 的东西?还是我必须 unlist(mclapply(..)) 才能实现这一点? 如果它不存在:推理是什么? 提前致谢,如果这是一个愚蠢的问题,我们深表
我喜欢在窗口中弹出结果,以便更容易查看和查找(例如,它们不会随着控制台继续滚动而丢失)。一种方法是使用 sink() 和 file.show()。例如: y <- rnorm(100); x <- r
我有一个如下所示的 spring mvc Controller @RequestMapping(value="/new", method=RequestMethod.POST) public Stri
我正在阅读 StructureMap关于依赖注入(inject),首先有两部分初始化映射,具体类类型的接口(interface),另一部分只是实例化(请求实例)。 第一部分需要配置和设置,这是在 Bo
我是一名优秀的程序员,十分优秀!