|
|
|
อยากทราบวิธีการเลือกข้อมูลที่ checkboxlist แล้วไปแสดงใน gridview |
|
|
|
|
|
|
|
อยากทราบวิธีการเลือกข้อมูลที่ checkboxlist แล้วไปแสดงใน gridview
โค้ดดังนี้คะ
Allocates.aspx
Code (C#)
<%@ Page Title="Home Page" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false"
CodeBehind="Allocates.aspx.vb" Inherits="Rescue.Allocates" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<style type="text/css">
.style13
{
width: 139px;
}
.style21
{
width: 111px;
}
.style22
{
width: 54px;
}
.style23
{
width: 97px;
}
.style24
{
width: 228px;
height: 73px;
}
.style25
{
width: 282px;
height: 73px;
}
.style26
{
height: 73px;
}
</style>
<script type="text/javascript">
var loaded = false;
function initMap() {
if (!loaded) {
initialize();
loaded = true;
}
}
</script>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<p>
<asp:ScriptManager ID="ScriptManagerAllocates" runat="server">
</asp:ScriptManager>
<asp:Label id="Msg" runat="server" ForeColor="Red" />
<asp:ObjectDataSource ID="ObjectMissionPlann" runat="server"
TypeName="Rescue.Rescue"
OldValuesParameterFormatString="original_{0}"
SelectMethod="SelectPlan"
InsertMethod="InsertPlan"
UpdateMethod="UpdatePlan"
DeleteMethod="DeletePlan" >
<DeleteParameters>
<asp:Parameter Name="plan_no" Type="Int32"/>
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="type_no" Type="String" />
<asp:Parameter Name="mission_date" Type="String" />
<asp:Parameter Name="mission_place" Type="String" />
</InsertParameters>
<SelectParameters>
<asp:Parameter Name="plan_no" Type="Int32" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="plan_no" Type="Int32" />
<asp:Parameter Name="type_no" Type="String"/>
<asp:Parameter Name="mission_date" Type="String" />
<asp:Parameter Name="mission_place" Type="String" />
</UpdateParameters>
</asp:ObjectDataSource>
<asp:FormView ID="FormView1" runat="server" DefaultMode="Insert" Width="790px" DataKeyNames="plan_no" DataSourceID="ObjectMissionPlann" >
<EditItemTemplate>
<table cellpadding="0" cellspacing="0" class="style1"
style="height: 121px; width: 100%">
<tr>
<td class="style24" valign="top">
<table cellpadding="0" cellspacing="0" class="style1">
<tr>
<td class="style23" align="center">
ประเภทภัยพิบัติ</td>
<td align="center">
<asp:Panel ID="Panel2" runat="server">
<asp:DropDownList ID="DDLDisaster" runat="server"
DataSourceID="SqlTypeDisaster" DataTextField="typeDisas"
DataValueField="type_no" Height="30px" SelectedValue='<%# Bind("type_no") %>'
Width="118px" AutoPostBack="True" onselectedindexchanged="TypeDisaster">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlTypeDisaster" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionStrings %>"
SelectCommand="SELECT type_no, typeDisas FROM mission_type">
</asp:SqlDataSource>
</asp:Panel>
</td>
</tr>
<tr>
<td align="center" class="style23">
ลำดับแผน</td>
<td align="center">
<asp:Label ID="plan_noLabel1" runat="server" Text='<%# Eval("plan_no") %>' />
<br />
</td>
</tr>
</table>
</td>
<td class="style25" valign="top">
<table cellpadding="0" cellspacing="0" class="style1"
style="height: 14px; width: 84%" align="center">
<tr>
<td class="style21" valign="top">
สถานที่</td>
<td class="style13" valign="top">
<asp:TextBox ID="mission_placeTextBox" runat="server"
Text='<%# Bind("mission_place") %>'/>
</td>
<td>
<!--โค้ดแผนที่-->
<asp:Button ID="BtnMap" runat="server" Text="Map" onclientclick="initMap()"/>
<asp:Panel ID="MapPanel" runat="server" ScrollBars=Auto Height="500px" Width="500px">
<div id="map_canvas" style="width: 100%; height: 100%"></div>
<input id="BtnRefresh" type="button" value="Refresh" onclick="ReMaps()" />
<asp:Button ID="BtnSubmit" runat="server" Text="Submit" />
<ajaxToolkit:ModalPopupExtender ID="BtnMap_ModalPopupExtender" runat="server"
DynamicServicePath="" Enabled="True" TargetControlID="BtnMap"
OkControlID="BtnSubmit" PopupControlID="MapPanel" onokscript="getCoor('MainContent_FormView1_mission_placeTextBox')" >
</ajaxToolkit:ModalPopupExtender>
</asp:Panel>
</td>
</tr>
</table>
</td>
<td class="style26" valign="top">
<table cellpadding="0" cellspacing="0" class="style1"
style="width: 76%; height: 25px" align="center">
<tr>
<td class="style22">
วันที่</td>
<td>
<asp:TextBox ID="mission_dateTextBox" runat="server"
Text='<%# Bind("mission_date") %>' />
<ajaxToolkit:CalendarExtender ID="mission_dateTextBox_CalendarExtender"
runat="server" Enabled="True" TargetControlID="mission_dateTextBox"
Format="dd/MM/yyyy">
</ajaxToolkit:CalendarExtender>
</td>
</tr>
</table>
</td>
<tr>
<td class="style24" valign="top">
</td>
<td class="style25" valign="top">
<table align="center" cellpadding="0" cellspacing="0" class="style1"
style="height: 10px; width: 89%">
<tr>
<td align="center" valign="top">
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True"
CommandName="Update" Text="ปรับปรุง" />
</td>
<td align="center" valign="top">
<asp:LinkButton ID="UpdateCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="ยกเลิก" />
</td>
</tr>
</table>
</td>
<td class="style26" valign="top">
</td>
</tr>
</EditItemTemplate>
<InsertItemTemplate>
<table cellpadding="0" cellspacing="0" class="style1"
style="height: 121px; width: 100%">
<tr>
<td class="style24" valign="top">
<table cellpadding="0" cellspacing="0" class="style1">
<tr>
<td class="style23" align="center">
ประเภทภัยพิบัติ</td>
<td align="center">
<asp:Panel ID="Panel2" runat="server">
<asp:DropDownList ID="DDLDisaster" runat="server"
DataSourceID="SqlTypeDisaster" DataTextField="typeDisas"
DataValueField="type_no" Height="30px" SelectedValue='<%# Bind("type_no") %>'
Width="118px" AutoPostBack="True" onselectedindexchanged="TypeDisaster">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlTypeDisaster" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionStrings %>"
SelectCommand="SELECT type_no, typeDisas FROM mission_type">
</asp:SqlDataSource>
</asp:Panel>
</td>
</tr>
<tr>
<td align="center" class="style23">
</td>
<td align="center">
</td>
</tr>
</table>
</td>
<td class="style25" valign="top">
<table cellpadding="0" cellspacing="0" class="style1"
style="height: 14px; width: 84%" align="center">
<tr>
<td class="style21" valign="top">
สถานที่</td>
<td class="style13" valign="top">
<asp:TextBox ID="mission_placeTextBox" runat="server"
Text='<%# Bind("mission_place") %>'/>
</td>
<td>
<!--โค้ดแผนที่-->
<asp:Button ID="BtnMap" runat="server" Text="Map" onclientclick="initMap()"/>
<asp:Panel ID="MapPanel" runat="server" ScrollBars=Auto Height="500px" Width="500px">
<div id="map_canvas" style="width: 100%; height: 100%"></div>
<input id="BtnRefresh" type="button" value="Refresh" onclick="ReMaps()" />
<asp:Button ID="BtnSubmit" runat="server" Text="Submit" />
<ajaxToolkit:ModalPopupExtender ID="BtnMap_ModalPopupExtender" runat="server"
DynamicServicePath="" Enabled="True" TargetControlID="BtnMap"
OkControlID="BtnSubmit" PopupControlID="MapPanel" onokscript="getCoor('MainContent_FormView1_mission_placeTextBox')" >
</ajaxToolkit:ModalPopupExtender>
</asp:Panel>
</td>
</tr>
</table>
</td>
<td class="style26" valign="top">
<table cellpadding="0" cellspacing="0" class="style1"
style="width: 76%; height: 25px" align="center">
<tr>
<td class="style22">
วันที่</td>
<td>
<asp:TextBox ID="mission_dateTextBox" runat="server"
Text='<%# Bind("mission_date") %>' />
<ajaxToolkit:CalendarExtender ID="mission_dateTextBox_CalendarExtender"
runat="server" Enabled="True" TargetControlID="mission_dateTextBox"
Format="dd/MM/yyyy">
</ajaxToolkit:CalendarExtender>
</td>
</tr>
</table>
</td>
<tr>
<td class="style24" valign="top">
</td>
<td class="style25" valign="top">
<table align="center" cellpadding="0" cellspacing="0" class="style1"
style="height: 10px; width: 89%">
<tr>
<td align="center" valign="top">
<asp:LinkButton ID="InsertButton0" runat="server" CausesValidation="True"
CommandName="Insert" Text="บันทึกแผนการกู้ภัย" />
</td>
<td align="center" valign="top">
<asp:LinkButton ID="InsertCancelButton0" runat="server"
CausesValidation="False" CommandName="Cancel" Text="ยกเลิก" />
</td>
</tr>
</table>
</td>
<td class="style26" valign="top">
</td>
</tr>
</InsertItemTemplate>
<ItemTemplate>
<table cellpadding="0" cellspacing="0" class="style1"
style="height: 121px; width: 100%">
<tr>
<td class="style24" valign="top">
<table cellpadding="0" cellspacing="0" class="style1">
<tr>
<td class="style23" align="center">
ประเภทภัยพิบัติ</td>
<td align="center">
<asp:Panel ID="Panel2" runat="server">
<asp:DropDownList ID="DDLDisaster" runat="server"
DataSourceID="SqlTypeDisaster" DataTextField="typeDisas"
DataValueField="type_no" Height="30px" SelectedValue='<%# Bind("type_no") %>'
Width="118px" AutoPostBack="True" onselectedindexchanged="TypeDisaster">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlTypeDisaster" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionStrings %>"
SelectCommand="SELECT type_no, typeDisas FROM mission_type">
</asp:SqlDataSource>
</asp:Panel>
</td>
</tr>
<tr>
<td align="center" class="style23">
ลำดับแผน</td>
<td align="center">
<asp:Label ID="plan_noLabel" runat="server" Text='<%# Eval("plan_no") %>' /></td>
</tr>
</table>
</td>
<td class="style25" valign="top">
<table cellpadding="0" cellspacing="0" class="style1"
style="height: 14px; width: 84%" align="center">
<tr>
<td class="style21" valign="top">
สถานที่</td>
<td class="style13" valign="top">
<asp:TextBox ID="mission_placeTextBox" runat="server"
Text='<%# Bind("mission_place") %>'/>
</td>
<td>
<!--โค้ดแผนที่-->
<asp:Button ID="BtnMap" runat="server" Text="Map" onclientclick="initMap()"/>
<asp:Panel ID="MapPanel" runat="server" ScrollBars=Auto Height="500px" Width="500px">
<div id="map_canvas" style="width: 100%; height: 100%"></div>
<input id="BtnRefresh" type="button" value="Refresh" onclick="ReMaps()" />
<asp:Button ID="BtnSubmit" runat="server" Text="Submit" />
<ajaxToolkit:ModalPopupExtender ID="BtnMap_ModalPopupExtender" runat="server"
DynamicServicePath="" Enabled="True" TargetControlID="BtnMap"
OkControlID="BtnSubmit" PopupControlID="MapPanel" onokscript="getCoor('MainContent_FormView1_mission_placeTextBox')" >
</ajaxToolkit:ModalPopupExtender>
</asp:Panel>
</td>
</tr>
</table>
</td>
<td class="style26" valign="top">
<table cellpadding="0" cellspacing="0" class="style1"
style="width: 76%; height: 25px" align="center">
<tr>
<td class="style22">
วันที่</td>
<td>
<asp:TextBox ID="mission_dateTextBox" runat="server"
Text='<%# Bind("mission_date") %>' />
<ajaxToolkit:CalendarExtender ID="mission_dateTextBox_CalendarExtender"
runat="server" Enabled="True" TargetControlID="mission_dateTextBox"
Format="dd/MM/yyyy">
</ajaxToolkit:CalendarExtender>
</td>
</tr>
</table>
</td>
<tr>
<td class="style24" valign="top">
</td>
<td class="style25" valign="top">
<table align="center" cellpadding="0" cellspacing="0" class="style1"
style="height: 10px; width: 89%">
<tr>
<td align="center" valign="top">
<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False"
CommandName="New" Text="สร้างใหม่" />
</td>
<td align="center" valign="top">
<asp:LinkButton ID="EditButton" runat="server" CausesValidation="False"
CommandName="Edit" Text="แก้ไข" />
</td>
</tr>
</table>
</td>
<td class="style26" valign="top">
</td>
</tr>
</ItemTemplate>
</asp:FormView>
</tr>
<tr>
<td class="style19" valign="top">
</td>
<td class="style20" valign="top">
</td>
<td valign="top">
</td>
</tr>
<tr>
<td class="style19" valign="top">
</td>
<td class="style20" valign="top">
</td>
<td valign="top">
</td>
</tr>
<tr>
<td class="style28" valign="top">
<table cellpadding="0" cellspacing="0" class="style1">
<tr>
<td>
เจ้าหน้าที่</td>
</tr>
<tr>
<td>
<asp:Panel ID="PanelSS" runat="server" ScrollBars=Auto Height="200px" Width="236px">
<asp:UpdatePanel ID="UpdatePanelSS" runat="server">
<ContentTemplate>
<asp:CheckBoxList ID="CBoxListStaff" runat="server" Width="200px"
AutoPostBack="True" DataSourceID="SqlDataSourceStaff"
DataTextField="staff_name" DataValueField="staff_no"
CausesValidation="True" >
</asp:CheckBoxList>
<asp:SqlDataSource ID="SqlDataSourceStaff" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionStrings %>"
FilterExpression="type_no='{0}'" SelectCommand="SELECT mission_skill.type_no, mission_skill.staff_no, staff.staff_name
FROM mission_skill INNER JOIN staff ON mission_skill.staff_no = staff.staff_no
WHERE (staff.avalible > 0)
ORDER BY mission_skill.skill_rank, staff.start_date, staff.brintday, staff.title, staff.staff_name, staff.gender">
<FilterParameters>
<asp:ControlParameter ControlID="MainContent$FormView1$DDLDisaster" Name="type_no"
PropertyName="SelectedValue" />
</FilterParameters>
</asp:SqlDataSource>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="MainContent$FormView1$DDLDisaster"
EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
</asp:Panel>
</td>
</tr>
</table>
</td>
<td class="style29" valign="top">
<table cellpadding="0" cellspacing="0" class="style1" align="center">
<tr>
<td>
<br />
<asp:GridView ID="gvStaff" runat="server"
DataSourceID="ObjectStaffPlan"
AutoGenerateColumns="False"
AllowPaging="True"
AllowSorting="True"
DataKeyNames="staff_no"
PageSize="5"
>
<Columns>
<asp:CheckBoxField HeaderText="หัวหน้าทีม" />
<asp:BoundField DataField="staff_no" HeaderText="รหัสบุคลากร" ReadOnly="True"
SortExpression="staff_no" />
<asp:BoundField DataField="title" HeaderText="คำหน้าหน้าชื่อ"
SortExpression="title" />
<asp:BoundField DataField="staff_name" HeaderText="ชื่อ-สกุล"
SortExpression="staff_name" />
<asp:BoundField HeaderText="อายุ" />
<asp:BoundField HeaderText="อายุงาน" />
<asp:BoundField DataField="tel1" HeaderText="เบอร์โทร" SortExpression="tel1" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectStaffPlan" runat="server"
DeleteMethod="DeleteStaff"
SelectMethod="SelectStaff"
InsertMethod="InsertStaff"
UpdateMethod="UpdateStaff"
TypeName="Rescue.StaffPlan" >
<DeleteParameters>
<asp:Parameter Name="plan_no" Type="Int32" />
<asp:Parameter Name="staff_no" Type="String" />
<asp:Parameter Name="StaffStatus" Type="String" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="plan_no" Type="Int32" />
<asp:Parameter Name="staff_no" Type="String"/>
<asp:Parameter Name="StaffStatus" Type="String" />
</InsertParameters>
<SelectParameters>
<asp:Parameter Name="plan_no" Type="Int32" />
<asp:Parameter Name="staff_no" Type="String" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="plan_no" Type="Int32" />
<asp:Parameter Name="staff_no" Type="String" />
<asp:Parameter Name="StaffStatus" Type="String" />
</UpdateParameters>
</asp:ObjectDataSource>
<br />
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
<asp:GridView ID="gvResou" runat="server" AutoGenerateColumns="False"
DataSourceID="ObjectResouPlan" AllowPaging="True" AllowSorting="True"
PageSize="5" DataKeyNames="resource_no">
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="resource_no" HeaderText="รหัสทรัพยากร" />
<asp:BoundField DataField="description" HeaderText="รายละเอียด" />
<asp:BoundField DataField="Qty" HeaderText="จำนวนเบิก" />
<asp:BoundField DataField="unit_dec" HeaderText="หน่วย" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectResouPlan" runat="server"
DataObjectTypeName="Rescue.Resource"
TypeName="Rescue.ResouPlan"
OldValuesParameterFormatString="original_{0}"
SelectMethod="SelectResou"
InsertMethod="InsertResou"
UpdateMethod="UpdateResou"
DeleteMethod="DeleteResou">
<DeleteParameters>
<asp:Parameter Name="plan_no" Type="Int32"/>
<asp:Parameter Name="resource_no" Type="String" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="resource_no" Type="String" />
<asp:Parameter Name="description" Type="String" />
<asp:Parameter Name="Qty" Type="String" />
<asp:Parameter Name="unit_dec" Type="String" />
</InsertParameters>
<SelectParameters>
<asp:Parameter Name="plan_no" Type="Int32" />
<asp:Parameter Name="resource_no" Type="String" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="plan_no" Type="Int32"/>
<asp:Parameter Name="resource_no" Type="String" />
<asp:Parameter Name="description" Type="String" />
<asp:Parameter Name="Qty" Type="String" />
<asp:Parameter Name="unit_dec" Type="String" />
</UpdateParameters>
</asp:ObjectDataSource>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</td>
<td valign="top" class="style30">
<table cellpadding="0" cellspacing="0" class="style1"
style="width: 30%">
<tr>
<td>
เครื่องมือ</td>
</tr>
<tr>
<td>
<asp:Panel ID="PanelR" runat="server" ScrollBars=Auto Height="200px">
<asp:UpdatePanel ID="UpdatePanelRR" runat="server">
<ContentTemplate>
<asp:CheckBoxList ID="CBoxListResou" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSourceResources" DataTextField="description"
DataValueField="resource_no" Width="135px" CausesValidation="True"
>
</asp:CheckBoxList>
<asp:SqlDataSource ID="SqlDataSourceResources" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionStrings %>"
FilterExpression="type_no='{0}'"
SelectCommand="SELECT mission_resource.type_no, mission_resource.resource_no, resource.description, resource.Qty, resource.unit_dec FROM mission_resource INNER JOIN resource ON mission_resource.resource_no = resource.resource_no WHERE (resource.avalible > 0) ORDER BY mission_resource.resource_rank">
<FilterParameters>
<asp:ControlParameter ControlID="MainContent$FormView1$DDLDisaster" Name="type_no"
PropertyName="SelectedValue" />
</FilterParameters>
</asp:SqlDataSource>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="MainContent$FormView1$DDLDisaster"
EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
</asp:Panel>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="style19" valign="top" align="center">
</td>
<td class="style20" align="center" valign="top">
<table cellpadding="0" cellspacing="0" class="style1" align="center"
style="width: 73%; height: 20px">
<tr>
<td align="center" valign="top">
<asp:LinkButton ID="LinkButton2" runat="server">บันทึกบุคลากร</asp:LinkButton>
</td>
<td align="center" valign="top">
<asp:LinkButton ID="LinkButton1" runat="server"
CommandName="PrintPlan" >พิมพ์แผน</asp:LinkButton>
</td>
<td align="center" valign="top">
<asp:LinkButton ID="Button" runat="server" CausesValidation="False"
CommandName="Cancel" Text="ดำเนินการต่อไป" />
</td>
</tr>
</table>
</td>
<td valign="top" align="center">
</td>
</tr>
</table>
</p>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=AIzaSyCfmTbw1YQ8okqF2iraC_ph2gfTRre0rw4&sensor=true"> </script>
<script src="Scripts/Map.js" type="text/javascript"></script>
</asp:Content>
Allocates.aspx.vb
Imports System
Imports System.Collections.Generic
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Public Class Allocates
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub TypeDisaster(ByVal sender As Object, ByVal e As EventArgs)
End Sub
'Public Property Rescue As Rescue
' Get
' End Get
' Set(ByVal value As Rescue)
' End Set
'End Property
' Public Property Area As Area
' Get
' End Get
' Set(ByVal value As Area)
' End Set
' End Property
' Public Property DisasterType As DisasterType
' Get
' End Get
' Set(ByVal value As DisasterType)
' End Set
'End Property
'Public Property Staff As Staff
' Get
' End Get
' Set(ByVal value As Staff)
' End Set
' End Property
'Public Property Resource As Resource
' Get
' End Get
' Set(ByVal value As Resource)
' End Set
' End Property
Protected Sub Formview1_ItemInserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewInsertedEventArgs) Handles FormView1.ItemInserted
End Sub
' Protected Sub Formview1_ItemUpdated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewUpdatedEventArgs) Handles FormView1.ItemUpdated
' gvStaff.DataBind()
' End Sub
' Protected Sub Formview1_ItemDeleted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewDeletedEventArgs) Handles FormView1.ItemDeleted
' gvStaff.DataBind()
' End Sub
Protected Sub PlanSource_OnInserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs) Handles ObjectMissionPlann.Inserted
' If Not Page.IsPostBack Then
ObjectMissionPlann.SelectParameters("plan_no").DefaultValue = e.ReturnValue.ToString()
ObjectStaffPlan.SelectParameters("staff_no").DefaultValue = e.ReturnValue.ToString()
ObjectResouPlan.SelectParameters("resource_no").DefaultValue = e.ReturnValue.ToString()
FormView1.ChangeMode(FormViewMode.Edit)
FormView1.DataBind()
'End If
End Sub
Protected Sub PlanSource_OnDeleted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs) Handles ObjectMissionPlann.Deleted
If Not Page.IsPostBack Then
If CInt(e.ReturnValue) = 0 Then _
MsgBox("MissionPlan was not updated. Please try again.")
End If
End Sub
Protected Sub PlanSource_OnUpdated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs) Handles ObjectMissionPlann.Updated
If Not Page.IsPostBack Then
If CInt(e.ReturnValue) = 0 Then _
MsgBox("MissionPlan was not deleted. Please try again.")
End If
End Sub
' Protected Sub CBoxListStaff_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles CBoxListStaff.SelectedIndexChanged
' ObjectStaffPlan.SelectParameters("plan_no").DefaultValue = e.ReturnValue.ToString()
' gvStaff.DataBind()
'End Sub
ติดปัญหาตรงที่ gvStaff.DataBind() คลิก CheckBoxList แล้ว ไม่แสดงที่ gridview หรือ gvStaff
Protected Sub CBoxListStaff_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles CBoxListStaff.SelectedIndexChanged
' If Not Page.IsPostBack Then
ObjectStaffPlan.SelectParameters("staff_no").DefaultValue = CBoxListStaff.SelectedValue.ToString()
ObjectStaffPlan.Insert()
gvStaff.DataBind()
'End If
End Sub
End Class
Tag : .NET, Ms SQL Server 2008, VBScript, Reporting Service, Web (ASP.NET), VS 2010 (.NET 4.x)
|
|
|
|
|
|
Date :
2012-07-18 23:00:54 |
By :
neel |
View :
1246 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เคยได้ตอบก่อนหน้านี้แล้วน่ะครับ ใช้พวก FindControl ครับ ดูได้จากบทความหรือค้นหาในกระทู้เก่า ๆ ครับ
|
|
|
|
|
Date :
2012-07-19 20:52:40 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|