I want to use nested gridview. But my Parent Grid is showing Nothing in ChildGrid's variable.
Any help? I've tried following ways:
1)
Dim gvChild As GridView =
CType(Me.gvwSubjectForProject.FindControl("gvChildGrid"), GridView)
2)
Dim gvChild As GridView =
Me.gvwSubjectForProject.FindControl("gvChildGrid")
gvChild.DataSource = dt_Subject
gvChild.DataBind()
I want to find Child grid's id and then want to assign it data source.
VB
Private Function FillGrid(ByVal mode As String, ByVal dt_Subject As
DataTable) As Boolean
'Dim dt_Subject As DataTable = Nothing
'Dim dt_sortsubject As DataTable = Nothing
Try
If (mode = "ParentGrid") Then
Me.gvwSubjectForProject.DataSource = Nothing
Me.gvwSubjectForProject.DataBind()
'Me.ViewState(VS_CurrentSubject) = Nothing
Me.btnExport.Visible = False
'dt_Subject.Columns.Add("Status", GetType(String))
If Not dt_Subject Is Nothing Then
If dt_Subject.Rows.Count > 0 Then
If dt_Subject.Rows.Count > 0 Then
For Each dr_Row In dt_Subject.Rows
If dr_Row("cStatus") = "AC" Then
dr_Row("Status") = "Active"
ElseIf dr_Row("cStatus") = "IA" Then
dr_Row("Status") = "In Active"
ElseIf dr_Row("cStatus") = "HO" Then
dr_Row("Status") = "Hold"
ElseIf dr_Row("cStatus") = "SC" Then
dr_Row("Status") = "Screened"
ElseIf dr_Row("cStatus") = "BO" Then
dr_Row("Status") = "Booked"
ElseIf dr_Row("cStatus") = "OS" Then
dr_Row("Status") = "On Study"
ElseIf dr_Row("cStatus") = "FI" Then
dr_Row("Status") = "Forever Ineligible"
Else
dr_Row("cStatus") = "Not Found"
End If
Next
Me.btnExport.Visible = True
'Me.ViewState(VS_CurrentSubject) = dt_Subject
Me.gvwSubjectForProject.DataSource = dt_Subject
Me.gvwSubjectForProject.DataBind()
End If
End If
End If
ElseIf (mode = "ChildGrid") Then
If Not dt_Subject Is Nothing Then
If dt_Subject.Rows.Count > 0 Then
'Me.gvwSubjectForProject.DataSource = dt_Subject
'Me.gvwSubjectForProject.DataBind()
'Me.gvwSubjectForProject.FindControl("gvChildGrid").DataSource =
dt_Subject
'CType(Me.gvwSubjectForProject.FindControl("gvChildGrid"),
GridView).DataBind()
'Me.gvwSubjectForProject.FindControl("gvChildGrid").
'Me.gvwSubjectForProject.FindControl("gvChildGrid").DataBind()
Dim gvChild As GridView = Me.gvwSubjectForProject.FindControl("gvChildGrid")
gvChild.DataSource = dt_Subject
gvChild.DataBind()
End If
End If
End If
Return True
Catch ex As Exception
Me.ShowErrorMessage("Error While Binding Grid", "....FillGrid")
Return False
End Try
End Function
HTML NESTED GRIDVIEW
<asp:Panel ID="pnlgvwSubjectStatus" runat="server" Style="max-height: 500px; overflow: auto;
width: 60%;">
<asp:GridView ID="gvwSubjectForProject" runat="server" AutoGenerateColumns="false"
SkinID="grdViewSmlAutoSize" Width="70%" ShowFooter="true" AllowPaging="true"
PageSize="1">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="imgbtnExpand" runat="server" ImageUrl="../images/Plus.gif" alt="Expand"
OnClientClick="imgbtnExpand_Click" />
<asp:HiddenField ID="hcStatus" runat="server" Value='<%# Eval("cStatus") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Status" HeaderText="STATUS">
<ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" Wrap="true" Width="40%" />
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="true" Width="40%" />
</asp:BoundField>
<asp:TemplateField>
<ItemTemplate>
<div style="max-height: 300px; width: 100%; overflow: auto;
text-align: right;">
<%--<asp:Panel ID="pnlOrders" runat="server" Width="100%">--%>
<asp:GridView ID="gvChildGrid" runat="server" AutoGenerateColumns="false" SkinID="grdViewSmlAutoSize">
<Columns>
<asp:BoundField ItemStyle-Width="40%" DataField="vSubjectID" HeaderText="SUBJECT ID">
<ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" Wrap="true" Width="40%" />
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="true" Width="40%" />
</asp:BoundField>
<asp:BoundField ItemStyle-Width="60%" DataField="FullName" HeaderText="FULL NAME">
<ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" Wrap="true" Width="60%" />
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="true" Width="60%" />
</asp:BoundField>
</Columns>
</asp:GridView>
<%--</asp:Panel>--%>
</div>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="TotalSubject" HeaderText="TOTAL SUBJECTS">
<ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" Wrap="true" Width="50%" />
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="true" Width="50%" />
</asp:BoundField>
</Columns>
</asp:GridView>
</asp:Panel>
And one more thing, in HTML when child gridview is not displayed, its still filling while creating its DOM. I want to delete that blank space too.
Your posted code is not working, because you are using the FindControl() method on the entire parent grid view control instead of on an individual row in the grid view control, like this:
Find child grid view in OnRowDataBound event:
Sub ParentGridView_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
' Only look for child grid view in data rows, ignore header and footer rows
If e.Row.RowType = DataControlRowType.DataRow Then
Dim theChildGridView As GridView = DirectCast(e.Row.FindControl("gvChildGrid"), GridView)
' Do something with theChildGridView here
End If
End Sub
Find child grid view by looping through all rows in parent grid view control:
For Each row As GridViewRow In ParentGridView.Rows
' Only look for child grid view in data rows, ignore header and footer rows
If row.RowType = DataControlRowType.DataRow Then
Dim theChildGridView As GridView = DirectCast(row.FindControl("gvChildGrid"), GridView)
' Do something with theChildGridView here
End If
Next
Related
I have a nested gridview as shown below. I populate the gridview from a stored procedure and method in my DAL/BLL layers. This works fine and data is returned to my nested gridview as I expect.
What I'd like to do though, is have the boundfield (VisitTypeId) in my nested gridview as a hyperlink, so the user can click on it and be redirected to the related 'Visit' for the Patient (in other words, 'where ID={0} and VisitTypeId={0}').
I'm certain this must be possible, but can't find a way to do it. Can someone please help?
Markup:
<asp:GridView ID="gvPatients" runat="server" AutoGenerateColumns="False" DataSourceID="odsPatients" OnRowDataBound="gvVisits_RowDataBound"
DataKeyNames="ID" AllowPaging="True" CssClass="interactTable" CellPadding="4"
AllowSorting="True" meta:resourcekey="gvPersonsResource1">
<HeaderStyle CssClass="header" />
<RowStyle CssClass="row"/>
<Columns>
<asp:TemplateField Visible="False">
<ItemTemplate>
<asp:Label ID="lblID" runat="server" Text='<%# Eval("ID")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:Boundfield DataField="ID" HeaderText="ID" />
<asp:Boundfield DataField="Forename" HeaderText="Forename" />
<asp:Boundfield DataField="Surname" HeaderText="Surname" />
<asp:Boundfield DataField="DoB" HeaderText="DoB" DataFormatString="{0:dd/MM/yyyy}" />
<asp:TemplateField HeaderText="Visits">
<ItemTemplate>
<asp:GridView ID="gvVisits" runat="server" AutoGenerateColumns="false" BorderWidth="0" ShowHeader="false" >
<Columns>
<%-- <asp:BoundField DataField="PatientID" Visible="false" /> --%>
<asp:BoundField DataField="VisitTypeID" />
</Columns>
</asp:GridView>
</ItemTemplate>
</asp:TemplateField>
<asp:HyperLinkField DataNavigateUrlFields="ID" DataNavigateUrlFormatString="~/AddEditPatient.aspx?ID={0}" HeaderText="Edit" Text="Edit" />
</Columns>
</asp:GridView>
DAL:
Public Shared Function GetVisitType(PatientId As Integer) As DataSet
Using myConnection As New SqlConnection(AppConfiguration.ConnectionString)
Using myCommand As New SqlCommand("SPGetVisitType", myConnection)
myCommand.CommandType = CommandType.StoredProcedure
myCommand.Parameters.AddWithValue("PatientID", PatientId)
myConnection.Open()
Dim ds As New DataSet()
Using myAdapter As New SqlDataAdapter(myCommand)
myAdapter.Fill(ds)
Return ds
End Using
myConnection.Close()
End Using
End Using
End Function
BLL:
Public Shared Function GetVisitType(ByVal PatientId As Integer) As DataSet
Dim ds As DataSet = ScreeningTestDAL.Visit.GetVisitType(PatientId)
Return ds
End Function
Codebehind:
Protected Sub gvVisits_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Dim gv As GridView = DirectCast(e.Row.FindControl("gvVisits"), GridView)
Dim PatientId As Integer = Convert.ToInt32(e.Row.Cells(1).Text)
Dim ds1 As DataSet = ScreeningTestBLL.VisitManager.GetVisitType(PatientId)
gv.DataSource = ds1
gv.DataBind()
End If
End Sub
I am using ASP.net and at some point I have a gridview that doesn't show up in my browser when I debug my project. On that same page do I use a textbox and that one does show up.
This is the HTML.
<%# Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/MasterPages/SvShop.Master" CodeBehind="Mijnoverzicht.aspx.vb" Inherits="SvShop.Mijnoverzicht" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<h1>Mijn Artikelen</h1>
<table>
<tr>
<td>Email</td>
<td>
<asp:TextBox ID="txtMijnEmail" runat="server" CssClass="tekstvak" Width="190px"></asp:TextBox>
</td>
</tr>
</table>
<div class="OverzichtMijn">
<asp:GridView ID="GridViewMijn" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataSourceID="MijnDataSource" AllowSorting="True" Width="845px">
<Columns>
<asp:BoundField DataField="ArtikelBeschrijving" HeaderText="Beschrijving" SortExpression="ArtikelBeschrijving" />
<asp:BoundField DataField="ArtikelPrijs" HeaderText="Prijs" SortExpression="ArtikelPrijs" />
<asp:BoundField DataField="ArtikelAankoopdatum" HeaderText="Aankoopdatum" SortExpression="ArtikelAankoopdatum" />
<asp:BoundField DataField="ArtikelTekoopgezet" HeaderText="Tekoopgezet" SortExpression="ArtikelTekoopgezet" />
<asp:BoundField DataField="GebruikersNaam" HeaderText="Naam" SortExpression="GebruikersNaam" />
<asp:BoundField DataField="GebruikersVoornaam" HeaderText="Voornaam" SortExpression="GebruikersVoornaam" />
<asp:BoundField DataField="GebruikersEmail" HeaderText="Email" SortExpression="GebruikersEmail" />
<asp:BoundField DataField="GebruikersGSM" HeaderText="GSM" SortExpression="GebruikersGSM" />
</Columns>
<EditRowStyle CssClass="GridViewEditRow" />
</asp:GridView>
<asp:SqlDataSource ID="MijnDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:SvShopInternString %>" ProviderName="<%$ ConnectionStrings:SvShopInternString.ProviderName %>" SelectCommand="SELECT tblArtikel.ArtikelBeschrijving, tblArtikel.ArtikelPrijs, tblArtikel.ArtikelAankoopdatum, tblArtikel.ArtikelTekoopgezet, tblGebruiker.GebruikersNaam, tblGebruiker.GebruikersVoornaam, tblGebruiker.GebruikersEmail, tblGebruiker.GebruikersGSM FROM ((tblArtikel INNER JOIN tblGebruiker ON tblArtikel.GebruikersID = tblGebruiker.GebruikersID) INNER JOIN tblRubriek ON tblArtikel.RubriekID = tblRubriek.RubriekID) WHERE (tblGebruiker.GebruikersEmail = '#Email')"></asp:SqlDataSource>
</div>
</asp:Content>
This is the browser view.
The problem should be in this line of code.
<asp:SqlDataSource ID="MijnDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:SvShopInternString %>" ProviderName="<%$ ConnectionStrings:SvShopInternString.ProviderName %>" SelectCommand="SELECT tblArtikel.ArtikelBeschrijving, tblArtikel.ArtikelPrijs, tblArtikel.ArtikelAankoopdatum, tblArtikel.ArtikelTekoopgezet, tblGebruiker.GebruikersNaam, tblGebruiker.GebruikersVoornaam, tblGebruiker.GebruikersEmail, tblGebruiker.GebruikersGSM FROM ((tblArtikel INNER JOIN tblGebruiker ON tblArtikel.GebruikersID = tblGebruiker.GebruikersID) INNER JOIN tblRubriek ON tblArtikel.RubriekID = tblRubriek.RubriekID) WHERE (tblGebruiker.GebruikersEmail = '#Email')"></asp:SqlDataSource>
The parameter
#Email
gets his value from the textbox above with this code:
Protected Sub txtMijnEmail_TextChanged(sender As Object, e As EventArgs) Handles txtMijnEmail.TextChanged
MijnDataSource.SelectCommand.Replace("#Email", txtMijnEmail.Text)
GridViewMijn.DataBind()
End Sub
Overkill - just add a Control Parameter to the SelectParameters:
<asp:SqlDataSource ID="MijnDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:SvShopInternString %>"
ProviderName="<%$ ConnectionStrings:SvShopInternString.ProviderName %>"
SelectCommand="SELECT <snip> WHERE (tblGebruiker.GebruikersEmail = '#Email')">
<SelectParameters>
<asp:ControlParameter
ControlID="txtMijnEmail"
PropertyName="Text"
Name="Email">
</asp:ControlParameter>
</SelectParameters>
</asp:SqlDataSource>
And obviously make sure your Select command returns a dataset when a valid email is provided.
Also consider temporarily setting GridViewMijn.ShowHeader="true" and GridViewMijn.EmptyDataText="No Data returned" for debugging purposes
when am trying to display total in footer it's not display .The grid view appear but without the footer I don't know what I miss but I know that there is no errors but the footer not display
my html :
<asp:TemplateField HeaderText="debit">
<ItemTemplate>
<asp:Label ID="lblDebAmount" runat="server" Text='<%# (Eval("v_flag").ToString() =="d" ) ? string.Format("{0:0.000}",float.Parse(Eval("v_amount").ToString())): "0.000" %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:Label ID="totallblDebAmount" runat="server" />
</FooterTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#336699" Font-
Bold="True" ForeColor="White" HorizontalAlign="Left" />
<HeaderStyle BackColor="#336699" Font-Bold="True" ForeColor="White"
HorizontalAlign="Left" />
my code :
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
decimal totalPrice = 0;
if (e.Row.RowType == DataControlRowType.DataRow)
{
Label lblDebAmount = (Label)e.Row.FindControl("lblDebAmount");
decimal debtotal = Decimal.Parse(lblDebAmount.Text);
totalPrice += debtotal;
}
if (e.Row.RowType == DataControlRowType.Footer)
{
Label totallblCAmount = (Label)e.Row.FindControl("totallblCAmount");
totallblCAmount.Text = totalPrice.ToString();
}
}
try to modify
Label totallblCAmount = (Label)e.Row.FindControl("totallblCAmount");
to be
Label totallblCAmount = (Label)e.Row.FindControl("totallblDebAmount");
I am building my website every thing is going good ,but when I run my website the grid view doesn't appear ,, please would any one help me how to fix the problem and let the grid view appear on the page
here is the aspx code :
<%# Page Title="" Language="VB" MasterPageFile="~/Member.master" AutoEventWireup="false" CodeFile="Order.aspx.vb" Inherits="Order" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
<script type="text/javascript">
var oldgridcolor;
function SetMouseOver(element) {
oldgridcolor = element.style.backgroundColor;
element.style.backgroundColor = '#ffeb95';
element.style.cursor = 'pointer';
element.style.textDecoration = 'underline';
}
function SetMouseOut(element) {
element.style.backgroundColor = oldgridcolor;
element.style.textDecoration = 'none';
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div style="margin-right: 0cm; margin-left: 4.1cm; height: 679px; background-color: #CC0000; width: 1038px; margin-bottom: 0px; margin-top: 109px;">
<fieldset style="width:230px;">
<legend style="font-family: 'Times New Roman', Times, serif; font-size: xx-large; color: #FFFF00; font-weight: normal; font-style: normal">Menu<asp:SqlDataSource
ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:conStr %>"
SelectCommand="SELECT * FROM [Menu]">
</asp:SqlDataSource>
<br />
</legend>
<asp:GridView ID="MenuGrid" runat="server" AutoGenerateColumns="false"
BackColor="White" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px"
CellPadding="4" DataKeyNames="MealNo" DataSourceID="SqlDataSource1"
Width="990px" GridLines="None" OnRowDataBound="EmpGridView_RowDataBound">
<Columns>
<asp:BoundField DataField="MealNo" HeaderText="MealNo" />
<asp:BoundField DataField="MealName" HeaderText="MealName" />
<asp:BoundField DataField="Desp" HeaderText="Desp" />
<asp:BoundField DataField="Price" HeaderText="Price" />
<asp:BoundField DataField="MealCateID" HeaderText="MealCateID"/>
</Columns>
<EditRowStyle BackColor="#2461BF" />
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#EFF3FB" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#F5F7FB" />
<SortedAscendingHeaderStyle BackColor="#6D95E1" />
<SortedDescendingCellStyle BackColor="#E9EBEF" />
<SortedDescendingHeaderStyle BackColor="#4870BE" />
</asp:GridView>
</fieldset>
</div>
</asp:Content>
vb code :
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Partial Class Order
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
BindEmpGrid()
End If
End Sub
Private Sub BindEmpGrid()
Dim dt As New DataTable()
Try
Dim con As New SqlConnection(ConfigurationManager.ConnectionStrings("conStr").ConnectionString)
Dim adp As New SqlDataAdapter("Select * from Menu", con)
adp.Fill(dt)
If dt.Rows.Count > 0 Then
MenuGrid.DataSource = dt
MenuGrid.DataBind()
Else
MenuGrid.DataSource = Nothing
MenuGrid.DataBind()
End If
Catch ex As Exception
Response.Write("Error Occured: " & ex.ToString())
Finally
dt.Clear()
dt.Dispose()
End Try
End Sub
Protected Sub EmpGridView_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles MenuGrid.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Attributes("onmouseover") = "javascript:SetMouseOver(this)"
e.Row.Attributes("onmouseout") = "javascript:SetMouseOut(this)"
End If
End Sub
End Class
You are not opening the connection anywhere. Open it or better wrap in Using ... End Using, Try like this:
Using con As New sqlConnection(ConfigurationManager.ConnectionStrings("conStr").ConnectionString)
Dim adp As New SqlDataAdapter("Select * from Menu", con)
adp.Fill(dt)
End Using
I want to select multible record in one time and update them by a buttom
I searched the internet by it's always cs and I want vb.net
I did my grid view as following
<asp:GridView ID="GridView1" runat="server" AutoGenerateCheckboxColumn="True"
CheckboxColumnIndex="0" AllowSorting="true"
AutoGenerateColumns="False" DataKeyNames="USER_ID"
DataSourceID="SqlDataSource1StudentActivList" CellPadding="2">
<Columns>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="FirstName" HeaderText="FirstName"
SortExpression="FirstName" />
<asp:BoundField DataField="LastName" HeaderText="LastName"
SortExpression="LastName" />
<asp:BoundField DataField="MiddleName" HeaderText="MiddleName"
SortExpression="MiddleName" />
<asp:BoundField DataField="ProgramCODE" HeaderText="ProgramCODE"
SortExpression="ProgramCODE" />
<asp:BoundField DataField="USER_NAME" HeaderText="USER_NAME"
SortExpression="USER_NAME" />
<asp:BoundField DataField="USER_Email" HeaderText="USER_Email"
SortExpression="USER_Email" />
<asp:BoundField DataField="MajorNameInEnglish" HeaderText="MajorNameInEnglish"
SortExpression="MajorNameInEnglish" />
<asp:BoundField DataField="GivenStudentID" HeaderText="GivenStudentID"
SortExpression="GivenStudentID" />
<asp:BoundField DataField="accepted" HeaderText="accepted"
SortExpression="accepted" />
<asp:BoundField DataField="Gender" HeaderText="Gender"
SortExpression="Gender" />
<asp:BoundField DataField="USER_ID" HeaderText="USER_ID" ReadOnly="True"
SortExpression="USER_ID" />
</Columns>
<SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1StudentActivList" runat="server"
ConnectionString="<%$ ConnectionStrings:mydbConnectionString %>"
SelectCommand="SELECT DISTINCT [FirstName], [LastName], [MiddleName], [ProgramCODE], [USER_NAME], [USER_Email], [MajorNameInEnglish], [GivenStudentID], [accepted], [Gender], [USER_ID] FROM [DIP_StudentsActivationList]">
</asp:SqlDataSource>
<p><asp:Label ID="lblSelection" runat="server" /></p>
<asp:Button ID="btupdate" runat="server" Text="Update" />
this is the VB code(converted) it's not what i want but i think i can deal with it
Imports System.Data
Imports System.Configuration
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Public Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs)
If MultiSelectGridView1.SelectedDataKeys.Count > 0 Then
lblSelection.Text = "You selected employees: "
For Each k As DataKey In MultiSelectGridView1.SelectedDataKeys
lblSelection.Text += k.Value.ToString() & ", "
Next
lblSelection.Text = lblSelection.Text.TrimEnd(","C, " "C)
Else
lblSelection.Text = "No employees selected"
End If
End Sub
End Class
and I want to change the accepted status in my database by clicking the buttom
any help please