Before I add in this part of session code, it will redirect me to BlogEntry.aspx if my username and password is correct. After I add in the session code, when I clicked the button nothing happening. Can you help me convert my session code to work in the javascript? I need to code it in the javascript and not in the code behind because I am using a html button. Because I want the design of the button, I need to do this. Unless you tell me there's a way to do it in the code behind. After login in login.aspx. It will redirect to logined.aspx and display welcome admin in the label.
Login.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
</style>
<link rel="stylesheet" type="text/css" href="stylesheets/loginstyle.css" />
<script language="javascript" type="text/javascript">
// <![CDATA[
function Button1_onclick() {
if (document.getElementById('txtUserName').value == "Admin" && document.getElementById('txtPassword').value == "123") {
//After add in session it cannot redirect START HERE
Session.Add("Username", txtUserName.Value);
Session.Add("Password", txtPassword.Value);
FormsAuthentication.SetAuthCookie(txtUserName.Value, true);
window.location.assign("BlogEntry.aspx")
//After add in session it cannot redirect END HERE
}
else
{
document.getElementById("<%=lblError.ClientID%>").innerHTML = "Name can't be blank!";
}
}
// ]]>
</script>
</head>
<body>
<div id="wrapper">
<form name="login-form" class="login-form" action="" method="post">
<div class="header">
<h1>Login Form</h1>
<span>Fill out the form below to login to my super awesome imaginary control panel.</span>
</div>
<div class="content">
<input name="username" type="text" class="input username" placeholder="Username" runat="server" id="txtUserName" />
<div class="user-icon"></div>
<input name="password" type="password" class="input password" placeholder="Password" runat="server" id="txtPassword" />
<div class="pass-icon"></div>
</div>
<div class="footer">
<input type="button" name="submit" value="Login" class="button" runat="server" id="Button1" önserverclick="Button1_Click" onclick="return Button1_onclick()" />
<asp:Label ID="lblError" runat="server" Text=""></asp:Label>
</div>
</form>
</div>
<div class="gradient"></div>
</body>
</html>
Logined.aspx
protected void Page_Load(object sender, EventArgs e)
{
//Logout.Visible = false;
string memName = (String)Session["UserName"];
lblUsername.Text = String.Concat("Welcome Guest!");
if (Session["Username"] != null && Session["Username"] != String.Empty)
{
lblUsername.Text = "Welcome, " + memName + "!";
}
}
For #Sangram
You can use html session storage or localStorage to store your key values. this will not need any server side code. The info will be there even if the user close the browser.
for browser compatibility: http://www.html5rocks.com/en/features/storage
for example: http://coding.smashingmagazine.com/2010/10/11/local-storage-and-how-to-use-it/
Related
I am trying to change the text of label in master page which is inside modal and from content page i am trying to set the text.
This is my master page:
<%# Master Language="C#" AutoEventWireup="true"
CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<!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 runat="server">
<title></title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1 maximum-
scale=1, user-scalable=no" />
<link href="../Content/bootstrap.min.css" rel="stylesheet" />
<link href="../Style/StyleSheet.css" rel="stylesheet" />
<link href="../Content/font-awesome.min.css" rel="stylesheet" />
<link href="http://fonts.googleapis.com/css?
family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet"
type="text/css" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/jquery-footable/0.1.0/css/footable.min.css" rel="stylesheet" type="text/css" />
<script src="../Scripts/jquery-1.9.1.min.js"></script>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<div id="header">
<form id="Form1" runat="server">
<header>
</header>
<div class="container-fluid" id="body">
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
</asp:ContentPlaceHolder>
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content" style="width: 400px;margin: 0 auto;">
<div class="modal-header" runat="server">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span></button>
<h4 class="modal-title"><asp:Label ID="lblMasterMessage" runat="server" Text="Label"></asp:Label> </h4>
</div>
<div class="modal-body">
<asp:Label ID="lblMasterbodyMessage" runat="server" Text="gh" />
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
<footer class="panel-footer white">
<div class="row">
</div>
</footer>
</form>
</div>
<script src="../Scripts/bootstrap.min.js"></script>
</body>
</html>
script in child page which opens modal:
<script type="text/javascript">
function openModal(message) {
$('#myModal').modal('show');
}
</script>
code behind child page calling the script and changing text of label in modalpopup
ScriptManager.RegisterStartupScript(this, this.GetType(), "LaunchServerSide", "$(function() { openModal(); });", true);
Label lblMaster = (Label)Master.FindControl("lblMasterbodyMessage");
string message = "something";
lblMaster.Text = message;
i also tried the second approach by setting properties in master page but text in the popup is not getting updated. any help will be appreciated
Best approach will be to provide a get/set property in your master page that will accept value and assign it to the label value property.
Master Page
public partial class MasterPage : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
public string MasterBodyMessage // you can use some meaningfull name over here.
{
get { return this.lblMasterbodyMessage.Text; }
set { this.lblMasterbodyMessage.Text = value; }
}
}
Child Page
ScriptManager.RegisterStartupScript(this, this.GetType(), "LaunchServerSide", "$(function() { openModal(); });", true);
var master = this.Master as MasterPage;
if (master != null)
{
master.MasterBodyMessage = "Some Meaningful Message!!!";
}
Else you can do some work around using javascript/jQuery to add message into label in master page. For this you will need to amend following changes.
HTML Aspx Page
<div class="modal-content" style="width: 400px;margin: 0 auto;">
<div class="modal-header">
<button aria-label="Close" class="close" data-dismiss="modal" type="button"><span aria-hidden="true">×</span></button>
<h4 class="modal-title"><label id="lblMasterMessage"></label></h4>
</div>
<div class="modal-body">
<label id="lblMasterbodyMessage"></label>
</div>
<div class="modal-footer">
<button class="btn btn-primary" data-dismiss="modal" type="button">Close</button>
</div>
</div>
Code Behind Page
string message = "Some Meaningful Message!!!";
ScriptManager.RegisterStartupScript(this, this.GetType(), "LaunchServerSide", "openModal('"+ message +"');", true);
jQuery Script
<script type="text/javascript">
function openModal(message) {
$('#myModal').modal('show');
$('#lblMasterbodyMessage').html(message);
}
</script>
Specify your master page class name in TypeName attribute of MasterType directive.
<%# MasterType TypeName="MasterPageClassName" %>
Now you can access your public properties as this.Master.propertyname
Also try by moving your code from page load event to PreRenderComplete event of page.
That'll solve you're problem
Help!
I have a login and and a signup html form, each toggle on clicking respective links on the form itself and there is no postback or page refresh event.
the problem is asp.net does not allow me to have two runat=server forms.
i can access input fields of the forms.
i have added asp:Button in place of input type="submit" in the forms in order to acces onclick methods, but then again asp.net does not allow me to add asp button (server side control) when i remove runat="server" from any of the forms which is having this asp button!
The question:
How can i access submit button of the forms so that i can perform necessary code behind operations for signup and login
Is there a way to achieve my goal? (may be some way to hide one of the forms in starting and show it when i click toggle link )
Here's the login register form's
Code:
<div>
<header>
</header>
<section>
<div id="container_demo" >
<a class="hiddenanchor" id="toregister"></a>
<a class="hiddenanchor" id="tologin"></a>
<div id="wrapper">
<div id="login" class="animate form">
<form id="form1" action="#" runat="server" >
<h1>Log in</h1>
<p>
<label for="username" class="uname" data-icon="u" > Your email </label>
<input id="username" name="username" runat="server" required="required" type="text" placeholder="myusername or mymail#mail.com"/>
</p>
<p>
<label for="password" class="youpasswd" data-icon="p"> Your password </label>
<input id="password" name="password" runat="server" required="required" type="password" placeholder="eg. X8df!90EO" />
</p>
<p class="keeplogin">
<input type="checkbox" name="loginkeeping" id="loginkeeping" value="loginkeeping" />
<label for="loginkeeping">Keep me logged in</label>
</p>
<p class="login button">
<asp:Button Text="Submit" runat="server" OnClick="Submit" />
<!--<input type="submit" value="Login" />-->
</p>
<p class="change_link">
Not a member yet ?
Join us //toggle link
</p>
</form>
</div>
<div id="register" class="animate form">
<form id="form2" action="#" runat="server" >
<h1> Sign up </h1>
<p style="margin-top:4px;margin-bottom:2px;">
<label for="usernamesignup" class="uname" data-icon="u">Your username</label>
<input id="usernamesignup" name="usernamesignup" runat="server" required="required" type="text" placeholder="mysuperusername690" />
</p>
<p style="margin-top:4px;margin-bottom:2px;">
<label for="emailsignup" class="youmail" data-icon="e" > Your email</label>
<input id="emailsignup" name="emailsignup" runat="server" required="required" type="email" placeholder="mysupermail#mail.com"/>
</p>
<p style="margin-top:4px;margin-bottom:2px;">
<label for="passwordsignup" class="youpasswd" data-icon="p">Your password </label>
<input id="passwordsignup" name="passwordsignup" runat="server" required="required" type="password" placeholder="eg. X8df!90EO"/>
</p>
<p style="margin-top:4px;margin-bottom:2px;">
<label for="mob1" class="uname" data-icon="u">Your mob no.</label>
<input id="mob" name="mob" runat="server" required="required" type="text" placeholder="9450.." />
</p>
<p class="signin button">
<asp:Button Text="Submit" runat="server" OnClick="Submitr" />
<!--<input type="submit" value="Sign up"/> -->
</p>
<p class="change_link">
Already a member ?
Go and log in //toggle link
</p>
</form>
</div>
</div>
</div>
</section>
</div>
Ok finally i got it after applying my brains!
this is what i did:
applied asp buttons on both server side forms
on signup form:
<asp:Button Text="tologin" runat="server" OnClick="changetologin" ForeColor="#1DA2C1" BackColor="#F7F8F1" />
on login form:
<asp:Button Text="Join us" runat="server" OnClick="changetosignup" ForeColor="#1DA2C1" BackColor="#F7F8F1" />
on page load:
protected void Page_Load(object sender, EventArgs e)
{
if (Session["form2"] == null && Session["form1"] == null) //show login hide signup
{
form1.Visible = true;
form2.Visible = false;
}
if (Session["form2"] != null && Session["form1"]==null ) //show signup hide login
{
form1.Visible = false;
form2.Visible = true;
Session["form2"] = null;
}
if (Session["form1"] != null && Session["form2"] == null) //show login hide signup
{
form1.Visible = true;
form2.Visible = false;
Session["form1"] = null;
}
}
on signup form on click of toggle button:
protected void changetologin(object sender, EventArgs e)
{
Session["form1"] = "clicked";
Response.Redirect("#tologin");
}
on login form on click of toggle button:
protected void changetosignup(object sender, EventArgs e)
{
Session["form2"] = "clicked";
Response.Redirect("#toregister");
}
In short:
combo of form visible property and session variable did the trick !!
how can i get the value of input control from masterpage ?
my master page:
.......
<div class="searchform">
<form id="formsearch" name="formsearch" method="post" action="#">
<span>
<input name="editbox_search" class="editbox_search" id="editbox_search" maxlength="80" value="Code Client:" type="text" />
</span>
<input name="button_search" src="images/search_btn.gif" class="button_search" type="image" />
</form>
</div>
</div>
<div class="clr"></div>
</div>
</div>
<div class="content">
<div class="content_resize">
<div class="mainbar">
<div class="article">
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</div>
.....
and my default.aspx that use MasterPAge:
protected void Page_Load(object sender, EventArgs e)
{
Label ClientId = (Label)Master.FindControl("editbox_search");
ASPxLabel_Err.Text = ClientId.Text;
}
i try to convert input Control into Label, because i can not find input control.
but i got nullReference that logic because i can not convert input control into label control.
var editbox = (HtmlInputControl)Master.FindControl("editbox_search");
Response.Write (editbox.Value);
try this
var mastertxt = (System.Web.UI.HtmlControls.HtmlInputText)Master.FindControl("ctl00$editbox_search");
ASPxLabel_Err.Text = mastertxt.Value;
first you need to make this tag as "runat= server" then only you can use:
var txtEditBox =(System.Web.UI.HtmlControls.HtmlInputText)this.Page.Master.FindControl("editbox_search");
ASPxLabel_Err.Text = txtEditBox.Value ;
Currently I have a website with a simple signup form in html, this is the code:
<div class="grid_6 push_3 block alpha">
<div class="grid_6 form_block alpha omega">
<label>שם משתמש</label>
</div>
<div class="grid_6 form_block alpha omega">
<input type="text" id="username" name="username" pattern="^\S{4,}$" required />
</div>
<div class="grid_6 alpha omega form_block">
<label>סיסמא</label>
</div>
<div class="grid_6 form_block alpha omega">
<input type="password" id="password" name="password" pattern="^\S{6,}$" required title="סיסמא צריכה להכיל לפחות 6 תווים" />
</div>
<div class="grid_6 alpha omega form_block">
<label>וודא סיסמא</label>
</div>
<div class="grid_6 form_block alpha omega">
<input type="password" id="password2" pattern="^\S{6,}$" required />
</div>
<div class="grid_6 alpha omega form_block">
<label>כתובת אימייל</label>
</div>
<div class="grid_6 form_block alpha omega">
<input id="email" name="email" type="email" required pattern="[^#]+#[^#]+\.[a-zA-Z]{2,6}" />
</div>
<div class="grid_6 alpha omega form_block">
<label>וודא כתובת אימייל</label>
</div>
<div class="grid_6 form_block alpha omega">
<input type="email" id="email2" required pattern="[^#]+#[^#]+\.[a-zA-Z]{2,6}" />
</div>
<div class="grid_6 form_block alpha omega">
<input name="submit" type="submit" onclick="return validateForm()" value="שלח" />
</div>
</div>
(Its actually being wrapped in tags from the master page, this is the master:
<%# Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="css/reset.css" rel="stylesheet" />
<link href="css/text.css" rel="stylesheet" />
<link href="css/963_9_10_10.css" rel="stylesheet" />
<link href="css/style.css" rel="stylesheet" />
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body dir="rtl">
<form runat="server">
<div class="container_9">
<div class="header grid_9">
<h1>סיכומים.נט</h1>
</div>
<!-- END HEADER -->
<nav>
<ul class="clearfix grid_6 push_3">
<li class="grid_1 alpha literature">ספרות</li>
<li class="grid_1 language">לשון</li>
<li class="grid_1 civics">אזרחות</li>
<li class="grid_1 history">היסטוריה</li>
<li class="grid_1 bible">תנך</li>
<li class="grid_1 omega english">אנגלית</li>
</ul>
</nav>
<div class="grid_3 pull_6" id="search">
<input type="text" id="search_box" placeholder="הקלד מילות חיפוש"/>
<input type="submit" value="חפש" id="search_button"/>
</div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
<footer class="grid_9">
2013 © כל הזכויות שמורות לסיכומים.נט
</footer>
</div>
<!-- END CONTAINER -->
</form>
</body>
</html>
I also have a signup.aspx.cs file that inserts the signup information into the database as follows:
public partial class signup : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Form["submit"] != null) {
register1();
}
}
public void register1()
{
string sql = "INSERT INTO [userinfo] ([username], [password], [email]) VALUES (N'" + Request.Form["username"] + "', N'" + Request.Form["password"] + "', N'" + Request.Form["email"] + "')";
Database.UpdateData(sql);
}
}
I think i'm doing everything right so far (I'm a beginner in anything beyond html/css) but correct me if I've made any errors.
What I want to do now is validate my form input server-side before I insert it into my database. I want to check that it obeys all my rules, char-lengths, matching fields and so forth - and also that the username/email isn't taken already.
I'm currently doing some basic javascript validation but I understand that isn't sufficient security wise.
an explanation (as simple as possible) as to what I have to go about doing now, would be great. Ideally i would like to return to the signup page and list the errors at the top of the form in a customizable way.
thanks
The RegularExpressionValidator and CompareValidator are going to be your friends here.
For example:
<asp:RegularExpressionValidator id="valEmail" ControlToValidate="email"
ValidationExpression="[^#]+#[^#]+\.[a-zA-Z]{2,6}"
EnableClientScript="false" ErrorMessage="The email is invalid!"
runat="server" />
And:
<asp:CompareValidator id="valEmails"
ControlToValidate="email" ControlToCompare="email2" Type="String"
EnableClientScript="false" Text="The email addresses must match!"
runat="server" />
Optionally, you can wrap them all neatly in a ValidationSummary control.
Finally, check Page.IsValid in your codebehind.
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Form["submit"] != null && Page.IsValid)
{
register1();
}
}
You can read about the other validation controls here.
Finally, fix your SQL so it's not vulnerable to SQL Injection:
string sql = "INSERT INTO [userinfo] ([username], [password], [email]) VALUES (N'" + Request.Form["username"].Replace("'","''") + "', N'" + Request.Form["password"].Replace("'","''") + "', N'" + Request.Form["email"].Replace("'","''") + "')";
You may want to use Asp.net server validation controls and Validation Summary Control
By using this control you can be sure that all rules will be followed. You can check it server side by using
if(page.IsValid)
{
//Code goes here
}
I have my masterpage:
<%# Master Language="C#" AutoEventWireup="true" CodeBehind="KezberProjectManager.master.cs" Inherits="KezberProjectManager.KezberProjectManager" %>
<!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 runat="server">
<title></title>
<!-- Le styles -->
<link href="assets/css/bootstrap.css" rel="stylesheet"/>
<link href="assets/css/bootstrap-responsive.css" rel="stylesheet"/>
<link href="assets/css/kezblu.styles.css" rel="stylesheet"/>
<style type="text/css">
</style>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.0.min.js"></script>
<script type="text/javascript" src="assets/js/kezcommon.js"></script>
<script type="text/javascript">
$(document).ready
(
function () {
createAutoClosingAlert('.success_alert', 6000);
}
);
function createAutoClosingAlert(selector, delay) {
var alert = $(selector).alert();
window.setTimeout(function () { $(alert).slideUp() }, delay);
}
</script>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<asp:Repeater runat="server" id="MenuRepeater">
<headertemplate>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="#">KezBlu</a>
<div class="nav-collapse collapse">
<ul class="nav">
</headertemplate>
<itemtemplate>
<%# Eval("Content") %>
</itemtemplate>
<footertemplate>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
</footertemplate>
</asp:Repeater>
<div id="wrap">
<div id="content">
<div id="alerts">
<div class="bs-docs-example">
<div id="auth">
<asp:HyperLink id="HyperLink1" runat="server">HyperLink</asp:HyperLink>
</br>
<asp:HyperLink id="HyperLink2" runat="server">HyperLink</asp:HyperLink>
</div>
<div runat="server" id="success_alert" class="success_alert alert alert-success fade in">
<button type="button" class="close" data-dismiss="alert">×</button>
<div runat="server" id="success_alert_text">
</div>
</div>
</div>
<div class="bs-docs-example">
<div runat="server" id="error_alert" class="error_alert alert alert-error fade in">
<button type="button" class="close" data-dismiss="alert">×</button>
<div runat="server" id="error_alert_text">
</div>
</div>
</div>
</div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</div>
</form>
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript" src="assets/js/bootstrap.min.js"></script>
</body>
</html>
In there I have:
<div id="auth">
<asp:HyperLink id="HyperLink1" runat="server">HyperLink</asp:HyperLink>
</br>
<asp:HyperLink id="HyperLink2" runat="server">HyperLink</asp:HyperLink>
</div>
Like this, the links show up fine in code behind.
Now, if I move them into my repeater's footer:
...
<div class="nav-collapse collapse">
<ul class="nav">
</headertemplate>
<itemtemplate>
<%# Eval("Content") %>
</itemtemplate>
<footertemplate>
</ul>
<div id="auth">
<asp:HyperLink id="HyperLink1" runat="server">HyperLink</asp:HyperLink>
</br>
<asp:HyperLink id="HyperLink2" runat="server">HyperLink</asp:HyperLink>
</div>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
</footertemplate>
</asp:Repeater>
Then they no longer can be used in code behind.
I really really do not understand this.
Why is it not working?
The RepeaterItem has a different NamingContainer. You can access only controls that are on top of the page directly since these controls are created in the partial codebehind class automatically. You have to use FindControl to get the reference of a control in a RepeaterItem.
In this case you could use the Repeater's ItemDataBound event:
protected void Repater1_ItemDataBound(Object Sender, RepeaterItemEventArgs e)
{
// This event is raised for the header, the footer, separators, and items.
if (e.Item.ItemType == ListItemType.Footer)
{
HyperLink hl = (HyperLink)e.Item.FindControl("HyperLink1");
}
}
Because the controls are no longer on the main form they are no longer properties of the Page. They can instead be accessed through the Repeater.
See this question for an example on accessing the controls through the Repeater.
When you are putting objects into Repeaters, Grids, etc, you have to do a lot more processing in the backend to be able to find them. Basically when the repeater is bound, you can go through and search for the object, and then access its properties.
For example here is a link to some code for a repeater looking up the various item controls when an Item is bound
protected void rptTaskListOnItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
{
var lnkEdit = e.Item.FindControl("lnkEdit") as HyperLink;
var lnkDelete = e.Item.FindControl("lnkDelete") as LinkButton;
var pnlAdminControls = e.Item.FindControl("pnlAdmin") as Panel;
var t = (Task)e.Item.DataItem;
if (IsEditable && lnkDelete != null && lnkEdit != null && pnlAdminControls != null)
{
pnlAdminControls.Visible = true;
lnkDelete.CommandArgument = t.TaskId.ToString();
lnkDelete.Enabled = lnkDelete.Visible = lnkEdit.Enabled = lnkEdit.Visible = true;
lnkEdit.NavigateUrl = EditUrl(string.Empty, string.Empty, "Edit", "tid=" + t.TaskId);
ClientAPI.AddButtonConfirm(lnkDelete, Localization.GetString("ConfirmDelete", LocalResourceFile));
}
else
{
pnlAdminControls.Visible = false;
}
}
}
Personally I have never tried to get to the controls in a header or footer of a repeater, but I am sure it would be something similar