Hi.i want to use a ajax updatepanel.on postnack i only want the datalist "dlEvnt" to get refreshed.but thats not happening.can anybody tell me what to do.
Here's my code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="news_evnts.aspx.cs" Inherits="news_evnts" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Prison Department, Goa</title>
<link rel="stylesheet" href="style.css" type="text/css" charset="utf-8" />
<script language="javascript" type="text/javascript">
function txtChk(){txtChanged('u'); txtChanged('p');}
function txtChanged(s){if(s=='u'){if(document.getElementById("txtEmail").value=="" || document.getElementById("txtEmail").value=="Login Id"){document.getElementById("txtEmail").value="Login Id"; document.getElementById("txtEmail").style.color="#aca899";}}
else if (s=='p') {if(document.getElementById("txtPass").value=="" || document.getElementById("txtPass").value=="Password"){document.getElementById("txtPass").value="Password";document.getElementById("txtPass").style.color="#aca899";}}}
function txtClick(s){if(s=='u'){if(document.getElementById("txtEmail").value=="Login Id"){ document.getElementById("txtEmail").value="";document.getElementById("txtEmail").style.color="#000000"; }}
else if(s=='p'){if(document.getElementById("txtPass").value=="Password"){ document.getElementById("txtPass").value="";document.getElementById("txtPass").style.color="#808080";}}}
var lastColorUsed, colUsed;
function dg_changeBackColor(row, highlight)
{
if (highlight)
{
lastColorUsed = row.style.backgroundColor;
colUsed = row.style.color;
row.style.backgroundColor ='#747170';//"#F7F7F7";// 'papayawhip';
row.style.color = 'WHITE';
row.style.cursor='hand';
}
else
{
row.style.backgroundColor = lastColorUsed;
row.style.color = colUsed;
}
}
function stopPost()
{
return false;
}
</script>
<script type="text/javascript">
function LoadDiv(url)
{
var img = new Image();
var bcgDiv = document.getElementById("divBackground");
var imgDiv = document.getElementById("divImage");
var imgFull = document.getElementById("imgFull");
var imgLoader= document.getElementById("imgLoader");
imgDiv.style.display = "block";
imgLoader.style.display = "block";
img.onload = function() {
imgFull.src = img.src;
imgFull.style.display = "block";
imgLoader.style.display = "none";
};
img.src= url;
var width = "10px";
//var width = document.body.clientWidth;
if (document.body.clientHeight > document.body.scrollHeight)
{
bcgDiv.style.height = "10px";
// bcgDiv.style.height = document.body.clientHeight + "px";
}
else
{
bcgDiv.style.height = "10px";
//bcgDiv.style.height = document.body.scrollHeight + "px" ;
}
// imgDiv.style.left = "100px";
// imgDiv.style.top = "50px";
// imgDiv.style.right = "100px";
// imgDiv.style.bottom = "50px";
bcgDiv.style.width="10px";
bcgDiv.style.display="block";
imgDiv.style.display="block";
return false;
}
function HideDiv()
{
var bcgDiv = document.getElementById("divBackground");
var imgDiv = document.getElementById("divImage");
var imgFull = document.getElementById("imgFull");
if (bcgDiv != null)
{
bcgDiv.style.display="none";
imgDiv.style.display="none";
imgFull.style.display = "none";
}
}
</script>
<script language="JavaScript" type="text/javascript">
var newBg;
function changeHl(strId)
{
newBg = "images/HlImg/"+strId+".jpg";
document.getElementById("imgHL").src = newBg;
}
function setURL()
{
var param = "height="+screen.height+",width="+screen.width+",resizable=yes,status=yes,toolbar=no,menubar=no,screenX=0,screenY=0,left=0,top=0";
var s = document.getElementById("ctl00_txtFilePath").value ;
window.open(s,"citizenchart",param);
}
</script>
</head>
<body>
<form id="mst" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div id="wrapper">
<div id="header">
<div style="color: #FFFFFF; font-family: 'Maiandra GD', 'Trebuchet MS', Tahoma, Verdana;">
<table id="tbl" width="100%">
<tr>
<td align="center" style="width: 145px">
<img src="images/bg_charity1.jpg" alt="gov" style="width: 76px; height: 84px" /></td>
<td>
<div style="font-size: 24px;">
Inspector General of Prisons</div>
<div style="font-size: 16px;">
Government of Goa</div>
</td>
</tr>
</table>
</div>
<div id="navlist">
<ul id="Ul1">
<li><a id="hm" runat="server" href="index.aspx">Home</a></li>
<%--<li><a id="hm" href="index.html">Home</a></li>--%>
<li><a id="au" runat="server" href="AboutUs.aspx">About Us</a></li>
<li><a id="am" runat="server" href="Amenities.aspx">Amenities</a></li>
<li><a id="ne" runat="server" href="news_evnts.aspx">News & Events</a></li>
<li><a id="pr" runat="server" href="jailproducts.aspx">Products</a></li>
<li><a id="rti" runat="server" href="rghtoinfrmtn.aspx">R. T. I.</a></li>
<li><a id="cc" runat="server" href="remission.aspx">Remission</a></li>
<li><a id="fb" runat="server" href="Default2.aspx">Feedback</a></li>
<li><a id="cu" runat="server" href="contact.aspx">Contact Us</a></li>
</ul>
</div>
</div>
<div id="headline">
<div id="photo">
<div>
<img src="images/igp.gif" width="618" height="250" alt="Pic 1" />
</div>
</div>
<div id="search-news" style="height: 248px">
<h2 class="downcast">
Quick Links</h2>
<br />
<div id="plussbullets">
<asp:HiddenField ID="txtFilePath" runat="server" />
<%-- <asp:TextBox ID="txtFilePath" runat="server" Width="71px" ></asp:TextBox>--%>
<ul>
<%-- <li> <asp:LinkButton ID="lbStats" runat="server" OnClick="stats_Click" >Prison Statistics</asp:LinkButton></li>--%>
<%--<li><asp:HyperLink ID="HyperLink1" runat="server" OnClick="stats_Click">Prison Statistics</asp:HyperLink></li>--%>
<%-- <li><a href="" onclick="stats_Click">
Prison Statistics </a></li>--%>
<li><a id="A1" href="" runat="server" onclick="setURL();" target="_blank">Prison Statistics</a></li>
<li><a href="rightsandduties.aspx">Rights & Duties of Prisoners</a></li>
<li><a href="reformation.aspx">Jail Reformation</a></li>
<li><a href="Citizen_new.pdf" target="_blank">Citizen's Charter</a></li>
<li><a href="listaddoff.aspx">List of area wise offices and Judicial Lock-Ups</a></li>
<li><a href="orgchart.aspx">Organisational Setup</a></li>
</ul>
</div>
</div>
<div class="clear">
</div>
</div>
<div id="body">
<div>
<div class="info">
News and Events</div>
<br />
<div style="width: 200px; float: right; padding: 2px 2px 2px 2px">
<div style="height: 400px; width: 200px; overflow: Auto;">
<asp:DataList ID="dlEvents" runat="server" Width="180px" GridLines="both" CellPadding="5"
OnItemCommand="getSelected" DataKeyField="prison_event_id">
<SelectedItemStyle BackColor="White" ForeColor="#99A866" />
<ItemTemplate>
<div style="background-image: url(images/bullet_plus.gif); background-repeat: no-repeat">
<div style="margin-left: 20px; padding-bottom: 2.5px;">
<asp:LinkButton ID="btnlEvntId" runat="server" Visible="false" CommandName="select"
Text='<%# Bind("prison_event_id") %>' />
<asp:LinkButton ID="btnlEvntTitle" runat="server" CommandName="select" Text='<%# Bind("prison_event_title") %>' />
</div>
</div>
</ItemTemplate>
<ItemStyle BackColor="White" ForeColor="#99A866" Font-Names="Tahoma, Verdana, sans-serif"
Font-Size=" 12px" Font-Bold="true" />
<HeaderTemplate>
<table bgcolor="white">
<tr style="font-family: Tahoma, Verdana, sans-serif; font-size: 14px; font-weight: bold;
background-color: #5C5C5C">
<td>
LIST OF EVENTS</td>
</tr>
<tr>
<td colspan="3">
<div style="overflow: scroll; height: 250px; width: 180px; font-size: 15px">
<table bgcolor="white" width="180px">
<%--<div> Titles</div>--%>
</HeaderTemplate>
<HeaderStyle BackColor="#5C5C5C" BorderColor="#859D31" BorderStyle="Solid" BorderWidth="1px"
Font-Names="Tahoma,Verdana,sans-serif" Font-Bold="True" Font-Size="11px" ForeColor="White" />
<FooterTemplate>
</table></div></td></tr></table></FooterTemplate>
</asp:DataList>
</div>
</div>
<%-- style="width: 351px; height:351px"--%>
<div style="width: 550px; float: left;">
<table border="0" id="tblEvntDetails" runat="server" visible="false" width="540px">
<tr>
<td colspan="4" style="background-color: #5C5C5C; font: bold 18px Tahoma, Verdana, sans-serif;
color: White; padding-bottom: 2px">
<asp:Label ID="lblEvntTitle" runat="server" Text='<%# Eval("prison_event_title") %>'
Visible="false"></asp:Label>
</td>
</tr>
<tr>
<td colspan="4">
<asp:ImageButton ID="btniEvntDtlImg" Height="350" Width="540" runat="server" />
</td>
</tr>
<tr>
<td colspan="4" style="font: bold 11px Tahoma, Verdana, sans-serif; padding-bottom: 4px">
<asp:Label ID="lblEvntDtlDesc" ForeColor="#5C5C5C" runat="server" Text='<%# Bind("prison_eventDtl_description") %>'
Width="535px"></asp:Label>
</td>
</tr>
<tr>
<td colspan="4" style="width: 540px">
<asp:UpdatePanel ID="updpEvnt" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<%--OnSelectedIndexChanged="selectedIndexChanged" "--%>
<asp:DataList ID="dlEvnt" runat="server" HorizontalAlign="Left" RepeatDirection="Horizontal"
BorderColor="#99A866" RepeatColumns="3" GridLines="Both" OnItemCommand="imageSelect"
DataKeyField="prison_eventDtl_srno" Visible="false">
<ItemTemplate>
<table width="100%" onmouseover="dg_changeBackColor(this, true);" onmouseout="dg_changeBackColor(this, false);">
<tr>
<td align="center" colspan="4">
<asp:ImageButton ID="imgDlEvnt" runat="server" Height="51px" Width="66px" AlternateText="Photo"
BorderColor="Silver" BorderStyle="Solid" ImageAlign="Middle" ImageUrl='<%# "~/ASHX/ImageHandler.ashx?queryType=dl_image&__KEY="+ Eval("prison_event_id")+"&__imgId="+Eval("prison_eventDtl_srno") %>'
CommandName="image" />
<br />
<asp:Label ID="lblImgDesc" runat="server" Visible="false" Text='<%# Bind("prison_eventDtl_Description") %>'></asp:Label>
<asp:Label ID="lblEvntId" runat="server" Visible="false" Text='<%# Bind("prison_event_id") %>'></asp:Label>
<asp:Label ID="lblImgSrno" runat="server" Visible="false" Text='<%# Bind("prison_eventDtl_srno") %>'></asp:Label>
<asp:Label ID="lblImgYn" runat="server" Visible="false" Text='<%# Bind("prison_eventDtl_activeYN") %>'></asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</ContentTemplate>
<%-- <Triggers>
<asp:AsyncPostBackTrigger ControlID="dlEvnt" EventName="ItemCommand" />
</Triggers>--%>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td colspan="1" style="font-weight: bold; color: #5C5C5C">
Date and Venue:
</td>
<td colspan="1">
<asp:Label ID="lblEvntDate" runat="server" Text='<%# Eval("prison_event_date") %>'
Visible="false"></asp:Label>
</td>
<td colspan="2">
<asp:Label ID="lblEvntVenue" runat="server" Text='<%# Eval("prison_event_venue") %>'
Visible="false"></asp:Label></td>
</tr>
<%-- <tr>
<td colspan="4">
<asp:Label ID="lblEvntDate" runat="server" Text='<%# Eval("prison_event_date") %>'
Visible="false"></asp:Label>
</td>
</tr>
<tr>
<td colspan="4">
<asp:Label ID="lblEvntVenue" runat="server" Text='<%# Eval("prison_event_venue") %>'
Visible="false"></asp:Label>
</td>
</tr>--%>
<tr>
<td colspan="4" style="font: 15px Tahoma, Verdana, sans-serif; padding-top: 4px;
border: solid 1px #99A866;">
<div style="height: 181px; overflow: auto;">
<asp:Label ID="lblEvntDesc" runat="server" Text='<%# Eval("prison_event_description") %>'></asp:Label></div>
</td>
</tr>
</table>
</div>
</div>
</div>
<p>
</p>
<div class="clear">
</div>
</div>
<div id="footer">
<p>
© 2009 all rights reserved.</p>
<p>
Developed & Maintained by Goa Electronics Limited
</p>
<p>
www.goaelectronics.co.in</p>
</div>
</form>
</body>
</html>