

language="html"<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="Dentist admin.aspx.cs" Inherits="WebApplication1.WebForm11" %>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div style="margin-left: 222px">
<br />
<span class="style7"><strong>Admin Dentist Panel<br />
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AutoGenerateColumns="False" BackColor="#CCCCCC" BorderColor="#999999"
BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2"
DataKeyNames="d_id" DataSourceID="SqlDataSource1" ForeColor="Black"
style="font-size: small">
<Columns>
<asp:CommandField ShowdeleteButton="True" ShowEditButton="True" />
<asp:BoundField DataField="d_id" HeaderText="d_id" ReadOnly="True"
SortExpression="d_id" />
<asp:BoundField DataField="d_name" HeaderText="d_name"
SortExpression="d_name" />
<asp:BoundField DataField="d_phone" HeaderText="d_phone"
SortExpression="d_phone" />
<asp:BoundField DataField="d_address" HeaderText="d_address"
SortExpression="d_address" />
<asp:ImageField DataImageUrlField="d_image"
DataImageUrlFormatString="E:\project apps\WebApplication1\WebApplication1"
HeaderText="d_image">
</asp:ImageField>
</Columns>
<FooterStyle BackColor="#CCCCCC" />
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
<RowStyle BackColor="White" />
<selectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#808080" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#383838" />
</asp:GridView>
</strong>
</span>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:DentistryConnectionString %>"
OldValuesParameterFormatString="original_{0}"
selectCommand="select [d_id], [d_name], [d_phone], [d_address], [d_image] FROM [Dentist]"
ConflictDetection="CompareAllValues"
deleteCommand="delete FROM [Dentist] WHERE [d_id] = @original_d_id AND [d_name] = @original_d_name AND [d_phone] = @original_d_phone AND (([d_address] = @original_d_address) OR ([d_address] IS NULL AND @original_d_address IS NULL)) AND (([d_image] = @original_d_image) OR ([d_image] IS NULL AND @original_d_image IS NULL))"
insertCommand="insert INTO [Dentist] ([d_id], [d_name], [d_phone], [d_address], [d_image]) VALUES (@d_id, @d_name, @d_phone, @d_address, @d_image)"
updateCommand="update [Dentist] SET [d_name] = @d_name, [d_phone] = @d_phone, [d_address] = @d_address, [d_image] = @d_image WHERE [d_id] = @original_d_id AND [d_name] = @original_d_name AND [d_phone] = @original_d_phone AND (([d_address] = @original_d_address) OR ([d_address] IS NULL AND @original_d_address IS NULL)) AND (([d_image] = @original_d_image) OR ([d_image] IS NULL AND @original_d_image IS NULL))">
<deleteParameters>
<asp:Parameter Name="original_d_id" Type="Int32" />
<asp:Parameter Name="original_d_name" Type="String" />
<asp:Parameter Name="original_d_phone" Type="String" />
<asp:Parameter Name="original_d_address" Type="String" />
<asp:Parameter Name="original_d_image" Type="Object" />
</deleteParameters>
<insertParameters>
<asp:Parameter Name="d_id" Type="Int32" />
<asp:Parameter Name="d_name" Type="String" />
<asp:Parameter Name="d_phone" Type="String" />
<asp:Parameter Name="d_address" Type="String" />
<asp:Parameter Name="d_image" Type="Object" />
</insertParameters>
<updateParameters>
<asp:Parameter Name="d_name" Type="String" />
<asp:Parameter Name="d_phone" Type="String" />
<asp:Parameter Name="d_address" Type="String" />
<asp:Parameter Name="d_image" Type="Object" />
<asp:Parameter Name="original_d_id" Type="Int32" />
<asp:Parameter Name="original_d_name" Type="String" />
<asp:Parameter Name="original_d_phone" Type="String" />
<asp:Parameter Name="original_d_address" Type="String" />
<asp:Parameter Name="original_d_image" Type="Object" />
</updateParameters>
</asp:SqlDataSource>
<br />
<span class="style6" __designer:mapid="4d"><strong __designer:mapid="4e">insert
Data In Dentist Table :</strong></span><br __designer:mapid="4f" /> ID :
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br __designer:mapid="51" />
Name :
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br __designer:mapid="53" />
address :
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<br __designer:mapid="55" />
phone :
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
<br />
<asp:FileUpload ID="FileUpload1" runat="server" />
<br __designer:mapid="57" />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="Enter Your Data" />
</div>
</asp:Content>ودة كود ال c# المستخدم :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
namespace WebApplication1
{
public partial class WebForm11 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["type"].ToString() != "admin")
{
Page.Visible = false;
}
else
{
}
}
protected void Button1_Click(object sender, EventArgs e)
{
DataSet1 ds = new DataSet1();
DataSet1TableAdapters.DentistTableAdapter dr = new DataSet1TableAdapters.DentistTableAdapter();
dr.Fill(ds.Dentist);
DataSet1.DentistRow or = ds.Dentist.NewDentistRow();
dr.insert(int.Parse(TextBox1.Text), TextBox2.Text, TextBox4.Text, TextBox3.Text,FileUpload1.FileBytes);
dr.Fill(ds.Dentist);
//GridView1.DataSource = ds.Dentist;
GridView1.DataBind();
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
}
}
}