I have a delete button on a repeater which is in update panel. When i click the delete button, it can delete, but It takes about 10 seconds. So I want to add a loading gif . I am beginner on adding gif. Please help me. Thanks for interests
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString='<%$ ConnectionStrings:NET2ConnectionString %>' SelectCommand="SELECT * FROM [ProductsRA]"></asp:SqlDataSource>
<asp:Repeater ID="rptuser" runat="server" DataSourceID="SqlDataSource1" OnItemCommand="rpr1_ItemCommand" OnItemDataBound="rpr1_ItemDataBound">
<ItemTemplate>
<tr>
<td class="GridItems">
<asp:ImageButton runat="server" ID="delbtn" ImageUrl="~/images/delete.gif" CommandName="Delete" CommandArgument='<%# Eval("ID") %>' ValidationGroup="ab" ToolTip="Delete User" /></td>
<td class="GridItems"><%# DataBinder.Eval(Container.DataItem,"ID") %></td>
<td class="GridItems"><%# DataBinder.Eval(Container.DataItem,"ProductName") %></td>
<td class="GridItems"><%# DataBinder.Eval(Container.DataItem,"Quantity") %></td>
<td class="GridItems"><%# DataBinder.Eval(Container.DataItem,"UnitPrice") %></td>
<td class="GridItems">
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="rptuser" />
</Triggers>
</asp:UpdatePanel>
this is cs:
protected void rpr1_ItemCommand(object source, RepeaterCommandEventArgs e)
{
DataSet.ProductsRADataTable dt = new DataSet.ProductsRADataTable();
DataSetTableAdapters.ProductsRATableAdapter adp = new DataSetTableAdapters.ProductsRATableAdapter();
if (e.CommandName == "Delete")
{
adp.DeleteQuery(Convert.ToInt32(e.CommandArgument));
}
}
You can use UpdateProgess control for this.
<asp:UpdateProgress ID="UpdateProgress1" runat="server"
AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<div class="loading_div">
<p>Please wait while we process the request.</p>
<img src="/Images/loader.gif" />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
Use an overlay div if you want to block the page while processing the request.
.loading_div {
position: absolute;
color:#fff;
background-color: #000;
z-index: 2000 !important;
opacity: 0.6;
overflow: hidden;
text-align: center;
top: 0;
left: 0;
height: 100%;
width: 100%;
padding-top:20%;
}
It will render like this while the request is processed: http://jsfiddle.net/codeandcloud/jLmbmLmn/
Related
My first 'Datalist1' retrieves some values from database i.e.,
Bus Route ID,
Vehicle number,
Trip date,
Bus source station name,
Bus Destination name
Another 'nested Datalist' which is placed inside datalist1 displays Bus icons of stages according to the number of stages between source and destination.
I succeeded to retrieving the data correctly and displayed a pop up using the above retrieved details.
<asp:DataList ID="DataList1" runat="server" RepeatColumns="1" CellSpacing="3" RepeatLayout="Table" BackColor="LightGray" OnItemDataBound="DataList1_DataBinding">
<ItemTemplate>
<table class="table">
<tr style="background-color : #b62a26; font-size:medium ; font-family:Verdana; height:40px ">
<td style="padding-left:5px">
<asp:Label ID="lblTrip" runat="server" Text="TripID:" ForeColor="White"></asp:Label>
</td>
<td style="width:900px; ">
<b> <asp:Label ID="lblTripID" runat="server" Text='<%# Eval("TripID") %>' ForeColor="White"></asp:Label></b></td>
</td>
</tr>
<tr style="background-color: white; font-size:small ; font-family:Verdana; height:60px; ">
<td colspan="2">
<b>RouteID: </b></b>
<asp:Label ID="lblRouteID" runat="server" Text='<%# Eval("RouteID") %>'></asp:Label>
<b>Vehicle NO: </b>
<asp:Label ID="lblVehicleNo" runat="server" Text='<%# Eval("VehicleNo") %>'></asp:Label>
<b>TripDate: </b>
<asp:Label ID="lblTripDate" runat="server" Text='<%# Eval("TripDate") %>'></asp:Label>
<b>From: </b>
<asp:Label ID="lblFromStage" runat="server" Text='<%# Eval("FromStage") %>'></asp:Label>
<b>To: </b>
<asp:Label ID="lblToStage" runat="server" Text='<%# Eval("ToStage") %>'></asp:Label>
</td>
</tr>
<tr style="background-color: white; font-size:small ; font-family:Verdana; height:10px ">
<td style="width:10px"></td>
<td>
<div id="activeBus" style="line-height: 0px; float: left; margin: 0px; padding: 0px; display: inline-block; vertical-align: top;">
<asp:DataList ID="innerDataList1" runat="server" RepeatColumns="10" CellSpacing="3" BackColor="white">
<ItemTemplate>
<asp:Panel ID="Panel2" runat="server" HorizontalAlign="center">
<table>
<tr style=" align-items:center ">
<td>
<asp:ImageButton ID="imgactiveBtn" runat="server" src="\images\ActiveRed.png" Width="15px" Height="15px" OnClick="imgBtn_Click" ToolTip="Track Details" />
<%-- <asp:ImageButton ID="ImageButton1" src="\images\ActiveRed.png" runat="server" Style="cursor: pointer" Width="15px" Height="15px" OnClientClick="return LoadDiv(this.src);"/> --%>
</td>
</tr>
<tr>
<td>
<b><asp:Label ID="lblStageName" runat="server" Text='<%# Eval("StageName") %>' Font-Size="XX-Small" Font-Names="Verdana" ></asp:Label></b>
</td>
</tr>
</table>
</asp:Panel>
</ItemTemplate>
</asp:DataList>
</div>
<div id="inactiveBus" style="line-height: 0px; float: left; margin: 0px; padding: 0px; display: inline-block; vertical-align: top;">
<asp:DataList ID="innerDataList" runat="server" RepeatColumns="10" CellSpacing="3" BackColor="white" OnItemDataBound="innerDataList_ItemDataBound">
<ItemTemplate>
<asp:Panel ID="Panel2" runat="server" HorizontalAlign="center">
<table>
<tr style=" align-items:center ">
<td>
<asp:ImageButton ID="imginactiveBtn" runat="server" src="\images\InActive.png" Width="15px" Height="15px" OnClick="imgBtn_Click" ToolTip="Not Reached yet!" />
</td>
</tr>
<tr>
<td>
<b><asp:Label ID="lblStageName" runat="server" Text='<%# Eval("StageName") %>' Font-Size="XX-Small" ForeColor="#CCCCFF"></asp:Label></b>
</td>
</tr>
</table>
</asp:Panel>
</ItemTemplate>
</asp:DataList>
</div>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
<div id="dialog" style="display: none">
<br />
<b>RouteID:</b> <span id="RouteID1"></span> <label id="lblEmpId"></label>
<br />
<b>TripDate:</b> <span id="TripDate1"></span> <label id="lblEmpName"></label>
<br />
<b>Stage Name:</b> <span id="StageName1"></span><label id="lblEmpLocation"></label>
<br />
<b>Scheduled Arrival:</b> <span id="Scheduled_Time1"></span>
<br />
<b>Reached On:</b> <span id="Arrival_Time1"></span>
<br /><br />
</div>
Jquery code is:
$(document).on("click", "[id*=imginactiveBtn]", function () {
$("#RouteID1").html($(".RouteID", $(this).closest("tr")).html());
$("#TripDate1").html($(".TripDate", $(this).closest("tr")).html());
$("#StageName1").html($(".StageName", $(this).closest("tr")).html());
$("#Scheduled_Time1").html($(".Scheduled_Time", $(this).closest("tr")).html());
$("#Arrival_Time1").html($(".Arrival_Time", $(this).closest("tr")).html());
// Get the Current Row and its values.
var currentRow = $(this).parents("tr");
var RId = currentRow.find("span[id*='lblRouteID']").text();
var TDate = currentRow.find("span[id*='lblTripDate']").text();
var SName = currentRow.find("span[id*='lblStageName']").text();
// Populate labels inside the dailog.
$("#lblEmpId").text(RId);
$("#lblEmpName").text(TDate);
$("#lblEmpLocation").text(SName);
$("#dialog").dialog({
title: "Track Vehicle at <em>" + SName + "</em>",
buttons: {
Ok: function () {
$(this).dialog('close');
}
},
modal: true
});
return false;
});
For example let us assume on 12/10/2017, 2 Trips were active with RouteID's 1 & 2, and each Routes has 3 stages.
When the first stage of route 1 is clicked Popup should display:
Route ID: Route1
TripDate: 12/10/2017
Stage Name: Stage1
When second icon is clicked Popup should should display
RouteID: Route1
TripDate: 12/10/2017
Stage: Stage2 and so on...
Similarly when Stages of Route2 is clicked
Route ID: Route2
TripDate: 12/10/2017
Stage Name: Stage1
and when he clicks second stage of Route 2
Route ID: Route2
TripDate: 12/10/2017
Stage Name: Stage2 and so on.....
But Popup displays:
RouteID: Route1Route2
TripDate: 12/10/201712/10/2017
StageName: Stage1Stage2Stage3Stage1Stage2Stage3
for all the 3 stages of Route1 and for all the 3 stages of Route2.
How can i resolve this. Where am i doing it wrong?
I am creating a social network site, I cant seem to get the "LinkEmail" in the code behind, I need this to function as I then use it to post to the database.
The LinkEmail is being dynamically generated in the first repeater, I need a way to grab that value.
at the moment I am getting this error in the browser:
Compiler Error Message: CS0103: The name 'LinkEmail' does not exist in the current context
this is aspx code
<asp:Repeater runat="server" ID="Repeater1">
<ItemTemplate>
<div style="border-top: thin none #91ADDD; border-bottom: thin none #91ADDD; padding: 10px; width: 548px; margin-top: 10px; right: 10px; left: 10px; border-left-width: thin; margin-left: 15px; background-color: #F6F6F6; border-left-color: #91ADDD; border-right-color: #91ADDD;">
<br />
<div style="width: 58px; height: 40px">
<asp:Image ID="Image2" runat="server" Height="59px" ImageAlign="Top" ImageUrl="~/Profile/Image/Default.png" Width="55px" />
</div>
<div style="width: 307px; margin-left: 65px; margin-top: -60px">
<asp:Label ID="Label6" runat="server" Font-Bold="True" Font-Names="Arial" ForeColor="#3b5998"><%#Eval("YourName") %> </asp:Label>
</div>
<div id="status" style=" width: 461px; margin-left: 78px; margin-top: 11px;"> <asp:Label ID="Label7" runat="server" Font-Italic="False" ForeColor="Black" Font-Size="Medium"><%#Eval("Birthday") %> </asp:Label>
<asp:LinkButton ID="LinkEmail" runat="server" OnClick="lbl_Click"><%#Eval("Email") %></asp:LinkButton>
<asp:Button ID="Button1" runat="server" Text="Button" />
</div>
</div>
</ItemTemplate>
Actually i want to get Link button generated text as a session like this photo when someone click this link. could you give me a suitable codes for this.
According to this photo amilamunasinha#gmail.com must be LinkEmail.Text ,,, I want like this
The first thing you have to do, once your Repeater control is on your Web page, is register for the ItemCommand event. I prefer to do this within the OnInit event of the page instead of placing it as an attribute of the asp:Repeater tag.
In .cs file:
override protected void OnInit(EventArgs e)
{
base.OnInit(e);
Repeater1.ItemCommand += new RepeaterCommandEventHandler(Repeater1_ItemCommand);
}
private void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
{
switch (e.CommandName)
{
case "mail":
string emailId = e.CommandArgument.ToString();
break;
}
}
In aspx:
<asp:LinkButton ID="LinkEmail" runat="server" CommandName="mail" CommandArgument='<%# Eval("Email") %>'><%#Eval("Email") %></asp:LinkButton>
I have this view in my asp.net application :
<asp:UpdatePanel ID="C_Compte" runat="server" UpdateMode="Conditional">
<ContentTemplate>
Métier:
<asp:TextBox ID="tbAddMetier" CssClass="Textboxes" Width="300px" Height="25px" runat="server"></asp:TextBox>
<asp:Button ID="btnAddMetier" runat="server" Text="Ajouter" CssClass="OffreEmploiSearch" OnClick="Button1_Click" />
<h4 style="font-weight: bold">Mes métiers</h4>
<asp:Repeater ID="rptrMetier" runat="server">
<ItemTemplate>
<div style="font: normal normal normal 14px/1.4em play, sans-serif; color: rgb(95, 94, 93); padding-left: 10px; line-height: 22px">
<strong><%# Eval("Lebelle") %></strong></a>
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Design_Ressources/img/attachment.png" OnCommand="ImageButton1_Command" CommandArgument='<%# Eval("Lebelle") %>' />
</div>
</ItemTemplate>
</asp:Repeater>
</ContentTemplate>
</asp:UpdatePanel>
in the code behind
protected void ImageButton1_Command(object sender, CommandEventArgs e)
{
string newjob = e.CommandArgument.ToString().Split(',')[0];
}
Edit Data Binding
protected void Button1_Click(object sender, EventArgs e)
{
string newjob = tbAddMetier.Text;
Metier m = new Metier { Lebelle = newjob };
CurrentCandidat.Metier1.Add(m);
try
{
notrecontexte.SaveChanges();
}
catch
{
}
tbAddMetier.Text = "";
rptrMetier.DataSource = CurrentCandidat.Metier1;
rptrMetier.DataBind();
C_Compte.Update();
}
My problem is that the button clic event is never fired!!
What is the reason?
How can i fix my code?
Add Postback trigger for Button1 as mentioned below :
<asp:UpdatePanel ID="C_Compte" runat="server" UpdateMode="Conditional">
<ContentTemplate>
Métier:
<asp:TextBox ID="tbAddMetier" CssClass="Textboxes" Width="300px" Height="25px" runat="server"></asp:TextBox>
<asp:Button ID="btnAddMetier" runat="server" Text="Ajouter" CssClass="OffreEmploiSearch" OnClick="Button1_Click" />
<h4 style="font-weight: bold">Mes métiers</h4>
<asp:Repeater ID="rptrMetier" runat="server">
<ItemTemplate>
<div style="font: normal normal normal 14px/1.4em play, sans-serif; color: rgb(95, 94, 93); padding-left: 10px; line-height: 22px">
<strong><%# Eval("Lebelle") %></strong></a>
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Design_Ressources/img/attachment.png" OnCommand="ImageButton1_Command" CommandArgument='<%# Eval("Lebelle") %>' />
</div>
</ItemTemplate>
</asp:Repeater>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnAddMetier"/>
</Triggers>
</asp:UpdatePanel>
I have two gridView: grvHeadline and gdvNotification, gdvNotification is load data by selected item of grvHeadline .
When page load: data of gdvNotification is load by first item of grvHeadline.
My problem is:
The page load is first: if gdvNotification has paging (1,2,3,...), when i click paging in gdvNotification, it not run. Page is reload but page index is 0.
When i select other item in grvHeadline and reselect first item, then click paging in gdvNotification, it run, page index was changed.
I was debug: When the page is load first time: I click to page index in gdvNotification then pageload() was called with IsPostBack=True, but not call to event gdvNotification_PageIndexChanging of gdvNotification.
Here is my code:
protected void gdvNotification_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
logger.Debug("Gridview Headline page index changing .");
gdvNotification.PageIndex = e.NewPageIndex;
HeadlineSelected(hdfNotificationIdSelected.Value, e.NewPageIndex);
//gdvNotification.DataBind();
lbPageIndex.Text = (e.NewPageIndex + 1).ToString(CultureInfo.InvariantCulture);
}
And
private void HeadlineSelected(string notificationIdSelected, int index)
{
logger.Debug("Head line selected");
GetDataFromSessionAndCache();
IList<InformationEntity> infoNotificationList = new List<InformationEntity>();
if (string.IsNullOrEmpty(notificationIdSelected))
{
//Clear
IList<InformationEntity> data = new List<InformationEntity>()
{
new InformationEntity()
{
AuthorName = string.Empty,
Contents = string.Empty,
BulletinDateFrom = null,
BulletinDateTo = null,
Id = string.Empty,
Subject = string.Empty,
}
};
gdvNotification.DataSource = data;
gdvNotification.DataBind();
pnPageIndex.Visible = false;
btnEditNotification.Enabled = false;
}
else
{
infoNotificationList = MasterDataHelper.GetInformationByHighOrderId(notificationIdSelected);
logger.Debug("Notification list not null");
if (infoNotificationList != null)
{
if (infoNotificationList.Count == 0)
{
pnPageIndex.Visible = false;
hdfNotificationId.Value = string.Empty;
btnEditNotification.Enabled = false;
}
else
{
if (infoNotificationList.Count == 1)
{
fakepanel.Visible = true;
}
else
{
fakepanel.Visible = false;
}
if (base.IsPermission(PERMISSION_INFORMATION_FOLLOWUP))
{
btnEditNotification.Enabled = true;
}
pnPageIndex.Visible = true;
gdvNotification.PageIndex = index;
hdfNotificationId.Value = infoNotificationList[index].Id;
gdvNotification.DataSource = infoNotificationList;
gdvNotification.DataBind();
}
logger.Debug("Set value for label total page");
lblTotalPage.Text = gdvNotification.PageCount.ToString(CultureInfo.InvariantCulture);
lbPageIndex.Text = gdvNotification.PageCount == 0
? gdvNotification.PageCount.ToString(CultureInfo.InvariantCulture)
: (gdvNotification.PageIndex + 1).ToString(CultureInfo.InvariantCulture);
lbTotal.Text = infoNotificationList.Count().ToString(CultureInfo.InvariantCulture);
}
}
}
Update code in view *.aspx.
<table style="padding-top: 25px; padding-bottom: 25px; table-layout: fixed" width="100%">
<tr>
<td style="width: 49%" class="Top">
<table class="Master" style="width: 100%; height: 35px; border-spacing: 2px 0px">
<tr style="padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;">
<td class="BasicValue" style="width: 100%; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;">
<asp:Panel ID="Panel2" runat="server" DefaultButton="btnSearch">
<asp:TextBox ID="txtFuzzySearch" runat="server" Style="width: 76%; height: 25px; text-align: left;
float: left; border-style: double; border-color: Gray;" />
<asp:Label ID="label" runat="server" Text="※あいまい検索" Width="20%" Style="text-align: center;
vertical-align: middle; margin-top: 5px;" />
<asp:Button ID="btnSearch" runat="server" Text="Button" Style="display: none" OnClick="btnSearch_Click" />
</asp:Panel>
</td>
</tr>
</table>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Panel ID="panelContainer" runat="server" Width="100%" Height="582px" Style="margin-top: 0px;overflow-y: auto">
<asp:HiddenField ID="hdfNotificationIdSelected" runat="server" Value="" />
<asp:GridView ID="grvHeadline" runat="server" AutoGenerateColumns="False" Style="width: 100%"
BorderWidth="0px" CellSpacing="2" CellPadding="10" GridLines="None" ShowHeader="false"
OnSelectedIndexChanged="grvHeadline_SelectedIndexChanged" OnRowDataBound="grvHeadline_RowDataBound">
<HeaderStyle CssClass="BasicColumnTitle" />
<AlternatingRowStyle CssClass="RowStyleEven" />
<RowStyle CssClass="RowStyleOdd" />
<SelectedRowStyle CssClass="RowStyleHi heallineSelected" />
<Columns>
<asp:TemplateField>
<HeaderStyle Width="10%" />
<ItemStyle Width="80%" />
<ItemTemplate>
<table style="border-spacing: 0px">
<tr>
<td>
<asp:Image ID="Image6" runat="server" ImageAlign="Left" Style="display: none" ImageUrl="../img/triangle-on.png" />
<asp:Image ID="Image1" runat="server" ImageAlign="Left" Style="display: none" ImageUrl="../img/triangle-off.png" />
<asp:Image ID="Image4" runat="server" Visible='<% #int.Parse(Eval("ThreadQty").ToString()) < 2%>'
ImageAlign="Left" ImageUrl="../img/Doc1.png" />
<asp:Image ID="Image5" runat="server" Visible='<% #int.Parse(Eval("ThreadQty").ToString())>=2%>'
ImageAlign="Left" ImageUrl="../img/Doc2.png" />
</td>
<td>
<asp:Label CssClass="bold" Style="resize: none; width: 100%; margin-left: 5px; vertical-align: bottom;
text-align: justify" ID="txt1" Text='<%#DevideString(HttpUtility.HtmlEncode(Eval("Subject")), 35) %>' runat="server">
</asp:Label><br />
<asp:Label CssClass="bold" Style="resize: none; margin-left: 5px; vertical-align: bottom; text-align: justify;"
ID="txt2" Text='<%#DevideString(HttpUtility.HtmlEncode(Eval("AuthorName")), 35) %>' runat="server" />
</td>
</tr>
</table>
<asp:HiddenField ID="hdfSelectedId" runat="server" Value='<% #Eval("Id")%>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderStyle Width="3%" />
<ItemStyle Width="20%" VerticalAlign="Top" CssClass="position" />
<ItemTemplate>
<table style="border-spacing: 0px; height: 100%;" width="100%">
<tr>
<td class="Top Left" style="height: auto;">
<asp:Image ID="Image3" runat="server" CssClass="Top Left" Visible='<%# ShowImgUpScreen(DateTime.Parse(Eval("BulletinDateFrom").ToString()),Eval("ThreadQty").ToString()) %>'
ImageAlign="Left" Style="vertical-align: top;" ImageUrl="~/img/Up1.png" />
<asp:Image ID="Image7" runat="server" CssClass="Top Left" Visible='<%# ShowImgNewScreen(DateTime.Parse(Eval("BulletinDateFrom").ToString()),Eval("ThreadQty").ToString()) %>'
ImageAlign="Left" Style="vertical-align: top;" ImageUrl="~/img/New2.png" />
</td>
</tr>
</table>
<asp:Label ID="Label4" runat="server" CssClass="Right Bottom" Text='<%#CheckDateTime((DateTime)Eval("BulletinDateFrom"))%>'
Style="float: right; position: absolute; bottom: 3px; right: 3px" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="grvHeadline" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
<table class="BasicValue" style="width: 100%; margin-bottom: -58px; margin-top: 43.5px">
<tr style="padding: 0px 0px 0px 0px; margin: 100px 0px 0px 0px;">
<td class="BasicValue" style="padding: 5px 10px 5px 10px">
<asp:Button ID="btnNewHeadline" class="ButtonSchedule" runat="server" Text="ヘッドラインの新親追加"
Height="100%" Style="text-align: center; float: right; margin: 0px 5px 0px 0px;"
Width="165px" OnClick="btnNewHeadlineRegist_Click" />
</td>
</tr>
</table>
</td>
<td style="width: 1%;" class="Center">
<div class="verticalLine" style="background-color: #C5C5CA; text-align: center; height: 696px;
width: 4px; margin-left: 48%">
</div>
</td>
<td style="width: 49%; position: relative" class="Top">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:HiddenField ID="hdfNotificationId" runat="server" />
<asp:GridView ID="gdvNotification" runat="server" AutoGenerateColumns="False" Style="width: 100%;"
BorderWidth="0px" CellSpacing="0" CellPadding="0" GridLines="None" PageSize="1"
AllowPaging="True" ShowHeader="false" OnPageIndexChanging="gdvNotification_PageIndexChanging">
<HeaderStyle CssClass="BasicColumnTitle" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Panel ID="panel1" runat="server" Width="100%" Height="618" ScrollBars="Vertical">
<table style="width: 100%;">
<tbody>
<tr style="height: 40px">
<td class="BasicValue" style="vertical-align: bottom;padding-left:2em">
<div>
<asp:Label ID="lblhead" CssClass="bold" runat="server" Text='<% #Eval("Subject")%>' Style=" font-weight: bold"></asp:Label>
</div>
</td>
</tr>
<tr style="height: 40px">
<td class=" BasicValue" style="vertical-align: bottom ;padding-left: 2em;">
<div>
<asp:Label ID="Label2" runat="server" Style=" font-weight: bold" Text='<% #Eval("AuthorName")%>'></asp:Label><asp:Label
ID="Label3" runat="server" Style="float: right" Text='<%# string.Format("{0:yyyy/MM/dd hh:mm}",Eval("BulletinDateFrom"))%>'></asp:Label></div>
</td>
</tr>
<tr style="height: 40px">
<td class="BasicValue" style="vertical-align: bottom">
<div>
<asp:Label ID="lblSection" runat="server" Style="padding-left: 2em;" Text='<%# GetSectionName(Eval("Id").ToString())%>'></asp:Label>
</div>
</tr>
<tr style="height: 497px;">
<td class="BasicValue" style="text-align: left; vertical-align: top; padding-left:2em ">
<asp:Label ID="lblContent" runat="server"
Text='<% #Eval("Contents")%>'></asp:Label>
</td>
</tr>
</tbody>
</table>
</asp:Panel>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Panel runat="server" ID="fakepanel" Height="30px">
</asp:Panel>
<div class="Center" style="margin-bottom: 0px; margin-top: 0cm; font-family: MS Pゴシック">
<asp:Panel ID="pnPageIndex" runat="server">
<span>Page
<asp:Label ID="lbPageIndex" runat="server" /><span>/</span><asp:Label ID="lblTotalPage"
runat="server"></asp:Label>
<span>(<asp:Label ID="lbTotal" runat="server"></asp:Label>件)</span></span>
</asp:Panel>
</div>
<table style="width: 100%;position: absolute; bottom: 0px">
<tr style="margin: 0px 0px 0px 0px;">
<td class="BasicValue" style="margin: 0px 0px 0px 0px; width: 100%; padding: 5px 10px 5px 10px">
<asp:Button ID="btnEditNotification" CssClass="ButtonSchedule" runat="server" Text="お知らせの編集"
Height="85%" Style="float: left; text-align: center; margin: 0px 10px 0px 0px; position: relative; left: 260px"
Width="158px" OnClick="btnEditNotification_Click" />
<asp:Button ID="btnUpdateNotification" CssClass="ButtonSchedule" runat="server" Text="このお知らせに追記"
Height="85%" Style="float: right; text-align: center; margin: 0px 5px 0px 0px;"
Width="158px" OnClick="btnUpdateNotification_Click" />
</td>
</tr>
</table>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="grvHeadline" EventName="SelectedIndexChanged" />
<asp:AsyncPostBackTrigger ControlID="gdvNotification" EventName="PageIndexChanging" />
</Triggers>
</asp:UpdatePanel>
</td>
</tr>
</table>
Can somebody tell me what's happening?
(p/s: i'm trying to learning English, if you don't understand, please tell me.)
I have a search button in my page. When I click the button, a paged datalist will show up
with result. I want to use modalPopupExtender with Datalist and collection pager. Is it possible ? Here is the code i tried but it doesn't work :
<asp:Label ID="Label5" runat="server"></asp:Label>
<asp:ModalPopupExtender ID="Label1_ModalPopupExtender" runat="server" CancelControlID="btThoat"
DynamicServicePath="" Enabled="True" PopupControlID="Panel1" TargetControlID="Label5">
</asp:ModalPopupExtender>
<asp:Panel ID="Panel1" runat="server">
<div style="margin-left: 20px; padding-top: 50px">
<asp:Label ID="lbl_CS" runat="server" Text="Ca sĩ" ForeColor="#FF33CC" Font-Size="18"
Visible="True"></asp:Label>
<asp:DataList ID="DataList1" runat="server" BackColor="White" BorderColor="#CC9966"
BorderStyle="None" BorderWidth="1px" CellPadding="4" GridLines="Both" RepeatColumns="4"
OnItemDataBound="DataList1_ItemDataBound">
<FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
<ItemStyle BackColor="White" ForeColor="#330099" />
<ItemTemplate>
<table>
<tr>
<td style="width: 10px">
<asp:RadioButton ID="rd_CS" runat="server" GroupName="Casi" Text='<%# Eval("MaCS")%>'
AutoPostBack="False"></asp:RadioButton>
</td>
<td style="width: 75px">
<asp:Image ID="Img_Casi" runat="server" ImageUrl='<%#Eval("Hinhanh")%>' Width="75px"
Height="75px" BorderColor="#66FF33" />
</td>
<td style="width: 50px">
<asp:Label ID="lbl_Ten" runat="server" Text='<%#Eval("TenCS")%>'></asp:Label>
</td>
<td style="width: 40px">
<asp:Label ID="lbl_Ngaysinh" runat="server" Text='<%#Eval("Ngaysinh")%>'></asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
<SelectedItemStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
</asp:DataList>
<cc2:CollectionPager ID="CollectionPager1" runat="server" MaxPages="1000" PagingMode="QueryString"
BackNextDisplay="Buttons" QueryStringKey="Datalist1">
</cc2:CollectionPager>
</div>
</asp:Panel>
Code in c#:
bool Checkcs()
{
string cs = "select MaCS, Quocgia, TenCS, Hinhanh, Thongtin, cast(convert(char(11), Ngaysinh, 113) as char) as Ngaysinh from casi where tencs like N'%" + txt_CS.Text + "%'";
da = new SqlDataAdapter(cs, cnn);
dtSP = new DataTable();
cnn.Open();
da.Fill(dtSP);
cnn.Close();
CollectionPager1.PageSize = 8;
CollectionPager1.DataSource = dtSP.DefaultView;
CollectionPager1.BindToControl = DataList1;
DataList1.DataSource = CollectionPager1.DataSourcePaged;
DataList1.DataBind();
Label1_ModalPopupExtender.Show();
if (dtSP.Rows.Count != 0)
return true;
else
return false;
}
protected void img_CheckCS_Click(object sender, ImageClickEventArgs e)
{
Checkcs();
}
If it's impossible. Is there another way to do it ? If it's possible. Can you show me an example code ? Any help would be great.
This is Sample. Please refer with this
.modalBackground {
background-color: Gray;
filter: alpha(opacity=80);
opacity: 0.8;
z-index: 10000;
}
.modalPopupCss {
background-color: white;
border-width: 1px;
border-style: solid;
border-color: #0066B3;
padding: 3px;
}
ASPX
<div>
<asp:ModalPopupExtender BackgroundCssClass="modalBackground" ID="Label1_ModalPopupExtender" CancelControlID="Button2" runat="server" Enabled="True" PopupControlID="Panel1" TargetControlID="lbl_CS"></asp:ModalPopupExtender>
<asp:Panel ID="Panel1" CssClass="modalPopupCss" runat="server">
<div style="margin-left: 20px; padding-top: 50px">
<asp:Label ID="lbl_CS" runat="server" Text="" ForeColor="#FF33CC" Font-Size="18" Visible="True"></asp:Label>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:GridView ID="GridView1" runat="server"></asp:GridView>
<asp:Button ID="Button2" runat="server" Text="Close" />
</div>
</asp:Panel>
<asp:Button ID="Button1" runat="server" Text="Search" OnClick="Button1_Click" />
Aspx.Cs
DataTable dt = new DataTable();
protected void Page_Load(object sender, EventArgs e)
{
dt.Columns.Add("ID");
dt.Columns.Add("Name");
dt.Columns.Add("State");
}
protected void Button1_Click(object sender, EventArgs e)
{
dt.Rows.Add("1", "Vignesh", "True");
GridView1.DataSource = dt;
GridView1.DataBind();
Label1_ModalPopupExtender.Show();
}