rObiinnn
Gebruiker
- Lid geworden
- 4 dec 2007
- Berichten
- 84
Als eerste wist ik niet waar ik deze vraag moest plaatsen aangezien er bij Website Bouwen geen VB staat. Verplaats maar als dat nodig is :thumb:
Ik moet een button hebben om te uploaden. ik zal me script plaatsen en dan vetgedrukt zetten waar het om gaat.
Script:
<%@ Page Language="VB" MasterPageFile="~/Default.master"
Title="File Management System" %>
<script runat="server">
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
SqlDataSource1.Insert()
TextBox1.Text = ""
CheckBox1.Checked = False
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
SqlDataSource1.Insert()
TextBox2.Text = ""
End Sub
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div id="body">
<div class="fullwidth">
<h2>Bestand Categorie Systeem</h2>
<p>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False"
DataKeyNames="CategoryID" DataSourceID="SqlDataSource1"
EmptyDataText="There are no categories present." Width="75%">
<Columns>
<asp:CommandField ShowDeleteButton="True"
ShowEditButton="True" />
<asp:BoundField DataField="CategoryID" HeaderText="CategoryID"
InsertVisible="False" ReadOnly="True"
SortExpression="CategoryID" />
<asp:BoundField DataField="CategoryName"
HeaderText="CategoryName" SortExpression="CategoryName" />
<asp:CheckBoxField DataField="IsPublic" HeaderText="IsPublic"
SortExpression="IsPublic" />
</Columns>
</asp:GridView>
<p>
<strong><span style="text-decoration: underline">Voeg een nieuwe categorie toe</span></strong></p>
<p>Categorie Naam:<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></p>
<p>
<asp:CheckBox ID="CheckBox1" runat="server"
Text="Vink aan als deze Categorie Privé is" /></p>
<p>
<asp:Button ID="Button1" runat="server" Text="Categorie toevoegen"
OnClick="Button1_Click" />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ClubSiteDB %>"
DeleteCommand="DELETE FROM [DocumentCategories] WHERE [CategoryID] =
@original_CategoryID"
InsertCommand="INSERT INTO [DocumentCategories] ([CategoryName],
[IsPublic]) VALUES (@CategoryName, @IsPublic)"
SelectCommand="SELECT * FROM [DocumentCategories]"
UpdateCommand="UPDATE [DocumentCategories] SET [CategoryName] =
@CategoryName, [IsPublic] = @IsPublic WHERE [CategoryID] =
@original_CategoryID">
<DeleteParameters>
<asp
arameter Name="original_CategoryID"
Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp
arameter Name="CategoryName" Type="String" />
<asp
arameter Name="IsPublic" Type="Boolean" />
<asp
arameter Name="original_CategoryID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:ControlParameter Name="CategoryName" Type="String"
ControlID="TextBox1" />
<asp:ControlParameter Name="IsPublic" Type="Boolean"
ControlID="CheckBox1" />
</InsertParameters>
</asp:SqlDataSource>
</p>
</div>
<div class="fullwidth">
<h2>Bestanden</h2>
<asp:GridView ID="GridView2" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="DocumentID" DataSourceID="SqlDataSource2" Width="75%">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
<asp:BoundField DataField="DocumentID" HeaderText="DocumentID" ReadOnly="True" SortExpression="DocumentID" />
<asp:BoundField DataField="DocumentName" HeaderText="DocumentName" ReadOnly="True"
SortExpression="DocumentName" />
<asp:BoundField DataField="DateInput" HeaderText="DateInput" SortExpression="DateInput" />
<asp:BoundField DataField="Comments" HeaderText="Comments" SortExpression="Comments" />
<asp:BoundField DataField="DocumentCategory" HeaderText="DocumentCategory" SortExpression="DocumentCategory" />
<asp:CheckBoxField DataField="TopDoc" HeaderText="TopDoc" SortExpression="TopDoc" />
</Columns>
</asp:GridView>
<br /><p>
<strong><span style="text-decoration: underline">Nieuw Bestand toevoegen</span></strong></p>
<br />
<asp
ropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1" DataTextField="CategoryName" DataValueField="CategoryID">
</asp
ropDownList>
<br />
<br />
Bestand Comments<br />
<asp:TextBox ID="TextBox2" runat="server" Width="271px"></asp:TextBox><br />
<br />
Bestand om te uploaden:<br />
<asp:FileUpload ID="FileUpload1" runat="server" Width="276px" /><br />
<asp:Label ID="Label1" runat="server" Text="Label" Width="486px" Font-Bold="True" Font-Size="12pt" ForeColor="Red"></asp:Label><br />
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Uploaden" Width="78px" /><br />
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ClubSiteDB %>"
DeleteCommand="DELETE FROM [Documents] WHERE [DocumentID] = @DocumentID" InsertCommand="INSERT INTO [Documents] ([DocumentID], [DocumentName], [DateInput], [Comments], [DocumentCategory], [TopDoc]) VALUES (@DocumentID, @DocumentName, @DateInput, @Comments, @DocumentCategory, @TopDoc)"
SelectCommand="SELECT * FROM [Documents]" UpdateCommand="UPDATE [Documents] SET [DocumentName] = @DocumentName, [DateInput] = @DateInput, [Comments] = @Comments, [DocumentCategory] = @DocumentCategory, [TopDoc] = @TopDoc WHERE [DocumentID] = @DocumentID">
<DeleteParameters>
<asp
arameter Name="DocumentID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp
arameter Name="DocumentName" Type="String" />
<asp
arameter Name="DateInput" Type="DateTime" />
<asp
arameter Name="Comments" Type="String" />
<asp
arameter Name="DocumentCategory" Type="Int32" />
<asp
arameter Name="TopDoc" Type="Boolean" />
<asp
arameter Name="DocumentID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:ControlParameter Name="Comments" Type="String"
ControlID="TextBox2" />
<asp:ControlParameter Name="DocumentCategory" Type="Int32"
ControlID="DropDownList1" PropertyName="SelectedValue" />
</InsertParameters>
</asp:SqlDataSource>
</div>
</div>
</asp:Content>
Wie heeft er verstand van en kan dit oplossen.
Alsvast bedankt (Y)
Ik moet een button hebben om te uploaden. ik zal me script plaatsen en dan vetgedrukt zetten waar het om gaat.
Script:
<%@ Page Language="VB" MasterPageFile="~/Default.master"
Title="File Management System" %>
<script runat="server">
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
SqlDataSource1.Insert()
TextBox1.Text = ""
CheckBox1.Checked = False
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
SqlDataSource1.Insert()
TextBox2.Text = ""
End Sub
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div id="body">
<div class="fullwidth">
<h2>Bestand Categorie Systeem</h2>
<p>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False"
DataKeyNames="CategoryID" DataSourceID="SqlDataSource1"
EmptyDataText="There are no categories present." Width="75%">
<Columns>
<asp:CommandField ShowDeleteButton="True"
ShowEditButton="True" />
<asp:BoundField DataField="CategoryID" HeaderText="CategoryID"
InsertVisible="False" ReadOnly="True"
SortExpression="CategoryID" />
<asp:BoundField DataField="CategoryName"
HeaderText="CategoryName" SortExpression="CategoryName" />
<asp:CheckBoxField DataField="IsPublic" HeaderText="IsPublic"
SortExpression="IsPublic" />
</Columns>
</asp:GridView>
<p>
<strong><span style="text-decoration: underline">Voeg een nieuwe categorie toe</span></strong></p>
<p>Categorie Naam:<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></p>
<p>
<asp:CheckBox ID="CheckBox1" runat="server"
Text="Vink aan als deze Categorie Privé is" /></p>
<p>
<asp:Button ID="Button1" runat="server" Text="Categorie toevoegen"
OnClick="Button1_Click" />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ClubSiteDB %>"
DeleteCommand="DELETE FROM [DocumentCategories] WHERE [CategoryID] =
@original_CategoryID"
InsertCommand="INSERT INTO [DocumentCategories] ([CategoryName],
[IsPublic]) VALUES (@CategoryName, @IsPublic)"
SelectCommand="SELECT * FROM [DocumentCategories]"
UpdateCommand="UPDATE [DocumentCategories] SET [CategoryName] =
@CategoryName, [IsPublic] = @IsPublic WHERE [CategoryID] =
@original_CategoryID">
<DeleteParameters>
<asp

Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp

<asp

<asp

</UpdateParameters>
<InsertParameters>
<asp:ControlParameter Name="CategoryName" Type="String"
ControlID="TextBox1" />
<asp:ControlParameter Name="IsPublic" Type="Boolean"
ControlID="CheckBox1" />
</InsertParameters>
</asp:SqlDataSource>
</p>
</div>
<div class="fullwidth">
<h2>Bestanden</h2>
<asp:GridView ID="GridView2" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="DocumentID" DataSourceID="SqlDataSource2" Width="75%">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
<asp:BoundField DataField="DocumentID" HeaderText="DocumentID" ReadOnly="True" SortExpression="DocumentID" />
<asp:BoundField DataField="DocumentName" HeaderText="DocumentName" ReadOnly="True"
SortExpression="DocumentName" />
<asp:BoundField DataField="DateInput" HeaderText="DateInput" SortExpression="DateInput" />
<asp:BoundField DataField="Comments" HeaderText="Comments" SortExpression="Comments" />
<asp:BoundField DataField="DocumentCategory" HeaderText="DocumentCategory" SortExpression="DocumentCategory" />
<asp:CheckBoxField DataField="TopDoc" HeaderText="TopDoc" SortExpression="TopDoc" />
</Columns>
</asp:GridView>
<br /><p>
<strong><span style="text-decoration: underline">Nieuw Bestand toevoegen</span></strong></p>
<br />
<asp

</asp

<br />
<br />
Bestand Comments<br />
<asp:TextBox ID="TextBox2" runat="server" Width="271px"></asp:TextBox><br />
<br />
Bestand om te uploaden:<br />
<asp:FileUpload ID="FileUpload1" runat="server" Width="276px" /><br />
<asp:Label ID="Label1" runat="server" Text="Label" Width="486px" Font-Bold="True" Font-Size="12pt" ForeColor="Red"></asp:Label><br />
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Uploaden" Width="78px" /><br />
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ClubSiteDB %>"
DeleteCommand="DELETE FROM [Documents] WHERE [DocumentID] = @DocumentID" InsertCommand="INSERT INTO [Documents] ([DocumentID], [DocumentName], [DateInput], [Comments], [DocumentCategory], [TopDoc]) VALUES (@DocumentID, @DocumentName, @DateInput, @Comments, @DocumentCategory, @TopDoc)"
SelectCommand="SELECT * FROM [Documents]" UpdateCommand="UPDATE [Documents] SET [DocumentName] = @DocumentName, [DateInput] = @DateInput, [Comments] = @Comments, [DocumentCategory] = @DocumentCategory, [TopDoc] = @TopDoc WHERE [DocumentID] = @DocumentID">
<DeleteParameters>
<asp

</DeleteParameters>
<UpdateParameters>
<asp

<asp

<asp

<asp

<asp

<asp

</UpdateParameters>
<InsertParameters>
<asp:ControlParameter Name="Comments" Type="String"
ControlID="TextBox2" />
<asp:ControlParameter Name="DocumentCategory" Type="Int32"
ControlID="DropDownList1" PropertyName="SelectedValue" />
</InsertParameters>
</asp:SqlDataSource>
</div>
</div>
</asp:Content>
Wie heeft er verstand van en kan dit oplossen.
Alsvast bedankt (Y)