Radio button grouping not working in repeater control - asp.net

This is what i am trying in aspx page
group name is not same in html code how can i manage it pls suggest
i am trying with the radio button in side a repeater control
<asp:Repeater ID="rptGoogleCalenderList" runat="server">
<ItemTemplate>
<tr>
<td style="width: 10px;">
<asp:RadioButton ID="radiocalenderList" CssClass="grpGoogleCalenderList" value="grpGoogleCalenderList" GroupName="GoogleCalenderList" runat="server" />
<%--<input id="" type="radio" name="" />--%>
</td>
<td colspan="3">
<asp:HiddenField ID="hfCalenderId" runat="server" Value='<%#Eval("CalenderId") %>' />
<%#Eval("CalenderName") %></td>
</tr>
</ItemTemplate>
</asp:Repeater>
this is what HTML generated for the above code
<tbody><tr>
<td style="width: 10px;">
<span class="grpGoogleCalenderList"><input id="Content_rptGoogleCalenderList_radiocalenderList_0" type="radio" name="ctl00$Content$rptGoogleCalenderList$ctl00$GoogleCalenderList" value="grpGoogleCalenderList"></span>
</td>
<td colspan="3">
<input type="hidden" name="ctl00$Content$rptGoogleCalenderList$ctl00$hfCalenderId" id="Content_rptGoogleCalenderList_hfCalenderId_0" value="omiai468mpv3ghgojvsgqnsiak#group.calendar.google.com">
my ct calender</td>
</tr>
<tr>
<td style="width: 10px;">
<span class="grpGoogleCalenderList"><input id="Content_rptGoogleCalenderList_radiocalenderList_1" type="radio" name="ctl00$Content$rptGoogleCalenderList$ctl01$GoogleCalenderList" value="grpGoogleCalenderList"></span>
</td>
<td colspan="3">
<input type="hidden" name="ctl00$Content$rptGoogleCalenderList$ctl01$hfCalenderId" id="Content_rptGoogleCalenderList_hfCalenderId_1" value="">
</td>
</tr>
<tr>
<td style="width: 10px;">
<span class="grpGoogleCalenderList"><input id="Content_rptGoogleCalenderList_radiocalenderList_2" type="radio" name="ctl00$Content$rptGoogleCalenderList$ctl02$GoogleCalenderList" value="grpGoogleCalenderList"></span>
</td>
<td colspan="3">
<input type="hidden" name="ctl00$Content$rptGoogleCalenderList$ctl02$hfCalenderId" id="Content_rptGoogleCalenderList_hfCalenderId_2" value="#contacts#group.v.calendar.google.com">
Birthdays</td>
</tr>
<tr>
<td style="width: 10px;">
<span class="grpGoogleCalenderList"><input id="Content_rptGoogleCalenderList_radiocalenderList_3" type="radio" name="ctl00$Content$rptGoogleCalenderList$ctl03$GoogleCalenderList" value="grpGoogleCalenderList"></span>
</td>
<td colspan="3">
<input type="hidden" name="ctl00$Content$rptGoogleCalenderList$ctl03$hfCalenderId" id="Content_rptGoogleCalenderList_hfCalenderId_3" value="en.indian#holiday#group.v.calendar.google.com">
Holidays in India</td>
</tr>
</tbody></table>

Use HTML radio button instead of ASP Radio button:-
<input type="radio" name="GoogleCalenderList" />
Unfortunately, asp radio button don't work inside repeater, so you need to do a work around either at client side or by using HTML control.

Related

Toggle radio buttons between to different sets

I would like to toggle selection between two different sets of radio buttons.
The condition that must be met is that if the user checks the button on one set (called in the example l1), it is unchecked in the other set (called in the example m1).
In other questions, it seems that it is only feasible solution is using Java scripts.
Below is the code:
<table border="0" cellpadding="1" cellspacing="1" style="width: 500px;">
<tbody>
<tr>
<td style="width: 300px;"> </td>
<td style="width: 100px; text-align: center;">Least</td>
<td style="width: 100px; text-align: center;">Most</td>
</tr>
<tr>
<td>{{question1}}</td>
<td style="text-align: center;"><input name="l1" type="radio" value="-1" /></td>
<td style="text-align: center;"><input name="m1" type="radio" value="1" /></td>
</tr>
<tr>
<td>{{question2}}</td>
<td style="text-align: center;"><input name="l1" type="radio" value="-2" /></td>
<td style="text-align: center;"><input name="m1" type="radio" value="2" /></td>
</tr>
<tr>
<td>{{question3}}</td>
<td style="text-align: center;"><input name="l1" type="radio" value="-3" /></td>
<td style="text-align: center;"><input name="m1" type="radio" value="3" /></td>
</tr>
<tr>
<td>{{question4}}</td>
<td style="text-align: center;"><input name="l1" type="radio" value="-4" /></td>
<td style="text-align: center;"><input name="m1" type="radio" value="4" /></td>
</tr>
</tbody>

I am not able to align my html control to right in html table

My requirement is I want to align my radio button to left in table cell, but it is not happening with the below code:
My code
<div data-role="collapsible" data-theme="b" data-content-theme="b">
<h3>Action</h3>
<table class="tabledata" width="100%">
<tr>
<td class="td1">
<p>
<input id="Radio1" type="radio" value="Approve" /></p>
</td>
<td class="td2">Approve</td>
</tr>
<tr>
<td>
<input id="Radio2" type="radio" /></td>
<td class="td2">Reject</td>
</tr>
<tr>
<td>
<input id="Radio3" type="radio" />
</td>
<td class="td2">Send Back to Requestor</td>
</tr>
<tr>
<td>Amount Approved for Domestic sector : </td>
<td>
<input id="Text1" type="text" /></td>
</tr>
<tr>
<td>Remarks : </td>
<td>
<input id="Text2" type="text" /></td>
</tr>
<tr>
<td class="tabledata">
<input id="Button1" type="button" value="Submit" />
</td>
</tr>
</table>
</div>
My CSS classes:
.td1 {
vertical-align:middle;
text-align:right;
}
.td2 {
text-align: left;
}
Actually I want to keep my radio button and its corresponding text in a table row by combining 2 columns and centre aligned and also submit button shoud be centre aligned in a table row since I am using jquery mobile datarole I guess it is not happening.Please help me to get the look.
After adding the script in head also I am getting below output:
Remove ui-radio class from each radio button.
$('[type=radio]').each(function () {
$(this).closest('div').removeClass('ui-radio');
});
and add class td1 to each radio button.
<tr>
<td class="td1">
<input id="Radio1" type="radio" value="Approve" />
</td>
<td class="td2">Approve</td>
</tr>
<tr>
<td class="td1">
<input id="Radio2" type="radio" />
</td>
<td class="td2">Reject</td>
</tr>
<tr>
<td class="td1">
<input id="Radio3" type="radio" />
</td>
<td class="td2">Send Back to Requestor</td>
</tr>
Demo
Alternative method: No jQuery code is required nor custom CSS styles. Read more about it here.
Why don't you use styled radio buttons, as in the below demo.
Alternative
new CSS:
tr td:nth-child(1) {
vertical-align:middle;
text-align:right;
}
http://jsfiddle.net/yHbdn/1/

How do I use html decode in my view page?

My engine is Aspx.
I am currently having trouble editing one of my columns(Question Answer) in my table because it has html tags in it. Is there a way I can decode only that specific row/column in the value area?
<form id="updateFreqQuestionsUser" action="<%=Url.Action("SaveFreqQuestionsUser","Prod")%>" method="post">
<table>
<tr>
<td colspan="3" class="tableHeader">Freq Questions User Details <input type ="hidden" value="<%=freqQuestionsUser.freqQuestionsUserId%>" name="freqQuestionsUserId"/> </td>
</tr>
<tr>
<td colspan="2" class="label">Question Description:</td>
<td class="content">
<input type="text" maxlength="2000" name="QuestionDescription" value="<%=freqQuestionsUser.questionDescription%>" />
</td>
</tr>
<tr>
<td colspan="2" class="label">QuestionAnswer:</td>
<td class="content">
<input type="text" maxlength="2000" name="QuestionAnswer" value="<%=freqQuestionsUser.questionAnswer%>" />
</td>
</tr>
<tr>
<td colspan="3" class="tableFooter">
<br />
<a id="freqQuestionsUserUpdateButton" href="#" class="regularButton">Save</a>
Cancel
</td>
</tr>
</table>
Yes, you can do this:
<input type="text" maxlength="2000" name="QuestionAnswer"
value="<%=Server.HtmlDecode(freqQuestionsUser.questionAnswer)%>" />
Reference

Html form is not working on a site created by .aspx

I have a similar problem. I use the Form from the website http://www.emailmeform.com/. Here is the code of my form:
<form id="emf-form" target="_blank" enctype="multipart/form-data" method="post" action="http://www.emailmeform.com/builder/form/7Sdql9bTKey" name="emf-form">
<table style="text-align:left;" cellpadding="2" cellspacing="0" border="0" bgcolor="#FFFFFF">
<tr>
<td style="" colspan="2">
<br />
</td>
</tr>
<tr valign="top">
<td id="td_element_label_0" style="" align="right">
<font face="Verdana" size="2" color="#000000"><b>Фамилия</b></font> <span style="color:red;"><small>*</small></span>
</td>
<td id="td_element_field_0" style="">
<input id="element_0" name="element_0" value="" size="20" class="validate[required]" type="text" />
<div style="padding-bottom:8px;color:#000000;"></div>
</td>
</tr>
<tr valign="top">
<td id="td_element_label_1" style="" align="right">
<font face="Verdana" size="2" color="#000000"><b>Имя</b></font> <span style="color:red;"><small>*</small></span>
</td>
<td id="td_element_field_1" style="">
<input id="element_1" name="element_1" value="" size="20" class="validate[required]" type="text" />
<div style="padding-bottom:8px;color:#000000;"></div>
</td>
</tr>
<tr valign="top">
<td id="td_element_label_2" style="" align="right">
<font face="Verdana" size="2" color="#000000"><b>Компания</b></font> <span style="color:red;"><small>*</small></span>
</td>
<td id="td_element_field_2" style="">
<input id="element_2" name="element_2" value="" size="30" class="validate[required]" type="text" />
<div style="padding-bottom:8px;color:#000000;"></div>
</td>
</tr>
<tr valign="top">
<td id="td_element_label_3" style="" align="right">
<font face="Verdana" size="2" color="#000000"><b>Email</b></font> <span style="color:red;"><small>*</small></span>
</td>
<td id="td_element_field_3" style="">
<input id="element_3" name="element_3" value="" size="30" class="validate[required]" type="text" />
<div style="padding-bottom:8px;color:#000000;"></div>
</td>
</tr>
<tr valign="top">
<td id="td_element_label_4" style="" align="right">
<font face="Verdana" size="2" color="#000000"><b>Телефон</b></font> <span style="color:red;"><small>*</small></span>
</td>
<td id="td_element_field_4" style="">
<input id="element_4" name="element_4" value="" size="30" class="validate[required]" type="text" />
<div style="padding-bottom:8px;color:#000000;"></div>
</td>
</tr>
<tr>
<td colspan="2">
<script type="text/javascript">
//<![CDATA[
var RecaptchaOptions = {
theme: 'clean',
custom_theme_widget: 'emf-recaptcha_widget'
};
//]]>
</script> <script type="text/javascript" src="https://www.google.com/recaptcha/api/challenge?k=6LchicQSAAAAAGksQmNaDZMw3aQITPqZEsX77lT9">
</script> <noscript><iframe src="https://www.google.com/recaptcha/api/noscript?k=6LchicQSAAAAAGksQmNaDZMw3aQITPqZEsX77lT9" height="300" width="500" frameborder="0"></iframe><br />
<textarea name="recaptcha_challenge_field" rows="3" cols="40">
</textarea> <input type="hidden" name="recaptcha_response_field" value="manual_challenge" /></noscript> <script type="text/javascript">
//<![CDATA[
$(function(){
$('#recaptcha_response_field').addClass('validate[required]');
});
//]]>
</script>
</td>
</tr>
<tr>
<td colspan="2" align="right">
<input name="element_counts" value="5" type="hidden" /> <input name="embed" value="forms" type="hidden" /><input value="Отправить" type="submit" />
</td>
</tr>
</table>
</form>
<div>
<font face="Verdana" size="2" color="#000000">Powered by</font><span style="position: relative; padding-left: 3px; bottom: -5px;"><img src=
"http://www.emailmeform.com/builder/images/footer-logo.png" /></span><font face="Verdana" size="2" color="#000000">EMF</font> <a style="text-decoration:none;" href="http://www.emailmeform.com/"
target="_blank"><font face="Verdana" size="2" color="#000000">Forms Online</font></a>
</div><a style="line-height:20px;font-size:70%;text-decoration:none;" href="http://www.emailmeform.com/report-abuse.html?http://www.emailmeform.com/builder/form/7Sdql9bTKey" target=
"_blank"><font face="Verdana" size="2" color="#000000">Report Abuse</font></a>
The site of origin after I get the error message “Invalid postback or callback argument. Â Event validation is enabled using in configuration or in a page. Â For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. Â If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.”
Site by cms on Bitrix format pages .aspx
What should I do to make this form work? I apologize for my English)
Are you pasting this html form inside your server form? runat="server" You may need to check the html output to confirm that.
The html specification does not permit nested forms. You can have multiple forms on a page, but only one with runat="server" the others need to be plain html forms like the one you posted above and needs to be placed outside the main server form. You can position it with CSS.
Try adding EnableEventValidation="false" to the page directive:
<%# Page ... EnableEventValidation="false" ...%>
This approach may lower your security, though.
Update
I tried your form. I created default web site in Visual Studio 2008. web.config file was one created by VS 2008. I used your code but stripped out script block. Also, the page header was as default:
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %>
That worked for me (except for captcha). At least, form worked:
Since I cannot really replicate your issue, I would suggest trying to make it work on separate web site (locally) first.

Not getting value in javascript

I have a datalist and in itemdatabound iam calling javascript and passing one argument.But iam not getting that argument in js.
<asp:Button ID="btnUpload" runat="server" cssClass="button1" Text="Upload" >
<asp:DataList ID="dlView" runat="server" >
<ItemTemplate>
<tr>
<td>
<asp:Image ID="imgPlan" runat="server" ImageUrl='<%#GetImage(Eval("ImageName")) %>' />
</td>
</tr>
<tr>
<td>
<asp:LinkButton ID="lnkChangeLogo" runat="server" Text="ChangeLogo" OnClientClick="javascript:showLayerUpLoad();return false;">
</asp:LinkButton>
<br />
<asp:LinkButton ID="lnkRemoveLogo" runat="server" Text="RemoveLogo" OnClientClick="javascript:ConfirmChoice();return false;"/>
<asp:TextBox ID="txtImage" runat="server" Text='<%#Eval("ImageName") %>'></asp:TextBox>
<asp:HiddenField ID="hdnImage" runat="server" Value='<%#Eval("ImageName")%>' />
</td>
</tr>
</ItemTemplate>
</asp:DataList>
In itemdatabound i have written following code
Protected Sub dlView_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles dlView.ItemDataBound
If e.Item.ItemType = ListItemType.Item Or _
e.Item.ItemType = ListItemType.AlternatingItem Then
Dim txtImage As TextBox = DirectCast(e.Item.FindControl("txtImage"), TextBox)
Dim s As String = txtImage.Text
btnUpload.OnClientClick = String.Format("javascript:UploadImages('{0}')", s)
End If
End Sub
Following is my javascript fn
function UploadImages(str)
{
alert(str);
}
Problem is in itemdatabound iam getting value in String.Format("javascript:UploadImages('{0}')", s)
but when clicking on btnUpload ,control is moving to UploadImages in js,but no value in str.
What may be the reason for that?Can anybody help please?
Following is html result
<link href="../CSS/PopupDiv.css" rel="stylesheet" type="text/css" /></head>
<div id="shadow" class="opaqueLayer"> </div>
<div id="question" class="questionLayer">
<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#F1ECDE">
<tr style="height:17">
<td style="background:url(../App_Images/bg/contentlefttop.gif)" width="26" height="17"> </td>
<td style="background:url(../App_Images/bg/contenttop.gif)"> </td>
<td style="background:url(../App_Images/bg/contentrighttop.gif)" width="26" height="17"> </td>
</tr>
<tr>
<td style="background:url(../App_Images/bg/contentleft.gif)" width="26"> </td>
<td bgcolor="#FFFFFF">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td style="text-align:justify; line-height:18px">
<img src="../App_Images/loading.gif" alt="Loading..."/>
</td>
</tr>
<tr>
<td>
Please Wait While the Values Load...
</td>
</tr>
</table>
</td>
<td style="background:url(../App_Images/bg/contentright.gif)" width="26"> </td>
</tr>
<tr style="height:17">
<td style="background:url(../App_Images/bg/contentleftbottom.gif)" width="26" height="17"> </td>
<td style="background:url(../App_Images/bg/contentbottom.gif)"> </td>
<td style="background:url(../App_Images/bg/contentrightbottom.gif)" width="26" height="17"> </td>
</tr>
</table>
</div>
<div id="questionUpLoad" class="questionLayer">
<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#F1ECDE">
<tr style="height:17">
<td style="background:url(../App_Images/bg/contentlefttop.gif)" width="26" height="17"> </td>
<td style="background:url(../App_Images/bg/contenttop.gif)"> </td>
<td style="background:url(../App_Images/bg/contentrighttop.gif)" width="26" height="17"> </td>
</tr>
<tr>
<td style="background:url(../App_Images/bg/contentleft.gif)" width="26"> </td>
<td bgcolor="#FFFFFF">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td style="text-align:justify; line-height:18px">
<strong> File Name:</strong><br />
<span id="spnUpload">
<input type="file" id="flUpload" />
</span>
</td>
</tr>
<tr>
<td>
<input type="submit" name="btnUpload" value="Upload" onclick="UploadImages('');" id="btnUpload" class="button1" />
<input type="submit" name="btnCancel" value="Cancel" onclick="javascript:hideLayerUpLoad();return false;" id="btnCancel" class="button1" />
</td>
</tr>
</table>
</td>
<td style="background:url(../App_Images/bg/contentright.gif)" width="26"> </td>
</tr>
<tr style="height:17">
<td style="background:url(../App_Images/bg/contentleftbottom.gif)" width="26" height="17"> </td>
<td style="background:url(../App_Images/bg/contentbottom.gif)"> </td>
<td style="background:url(../App_Images/bg/contentrightbottom.gif)" width="26" height="17"> </td>
</tr>
</table>
</div>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td rowspan="6" colspan="2" align="left" style="padding-right:5px; width: 125px;" >
<table id="dlView" cellspacing="0" border="0" style="border-collapse:collapse;">
<tr>
<td>
<tr>
<td>
<img id="dlView_ctl00_imgPlan" src="../SiteImages/vidhya/40/1/ThumbNails/abc.jpg" style="border-width:0px;" />
</td>
</tr>
<tr>
<td>
<a onclick="javascript:showLayerUpLoad();return false;" id="dlView_ctl00_lnkChangeLogo" href="javascript:__doPostBack('dlView$ctl00$lnkChangeLogo','')">ChangeLogo</a>
<br />
<a onclick="javascript:ConfirmChoice();return false;" id="dlView_ctl00_lnkRemoveLogo" href="javascript:__doPostBack('dlView$ctl00$lnkRemoveLogo','')">RemoveLogo</a>
<input name="dlView$ctl00$txtImage" type="text" value="abc.jpg" id="dlView_ctl00_txtImage" />
<input type="hidden" name="dlView$ctl00$hdnImage" id="dlView_ctl00_hdnImage" value="abc.jpg" />
</td>
</tr>
</td>
</tr><tr>
<td>
<tr>
<td>
<img id="dlView_ctl01_imgPlan" src="../SiteImages/vidhya/40/1/ThumbNails/qwe.DIhJfEPC" style="border-width:0px;" />
</td>
</tr>
<tr>
<td>
<a onclick="javascript:showLayerUpLoad();return false;" id="dlView_ctl01_lnkChangeLogo" href="javascript:__doPostBack('dlView$ctl01$lnkChangeLogo','')">ChangeLogo</a>
<br />
<a onclick="javascript:ConfirmChoice();return false;" id="dlView_ctl01_lnkRemoveLogo" href="javascript:__doPostBack('dlView$ctl01$lnkRemoveLogo','')">RemoveLogo</a>
<input name="dlView$ctl01$txtImage" type="text" value="qwe.DIhJfEPC" id="dlView_ctl01_txtImage" />
<input type="hidden" name="dlView$ctl01$hdnImage" id="dlView_ctl01_hdnImage" value="qwe.DIhJfEPC" />
</td>
</tr>
</td>
</tr><tr>
<td>
<tr>
<td>
<img id="dlView_ctl02_imgPlan" src="../SiteImages/vidhya/40/1/ThumbNails/asd.jpg" style="border-width:0px;" />
</td>
</tr>
<tr>
<td>
<a onclick="javascript:showLayerUpLoad();return false;" id="dlView_ctl02_lnkChangeLogo" href="javascript:__doPostBack('dlView$ctl02$lnkChangeLogo','')">ChangeLogo</a>
<br />
<a onclick="javascript:ConfirmChoice();return false;" id="dlView_ctl02_lnkRemoveLogo" href="javascript:__doPostBack('dlView$ctl02$lnkRemoveLogo','')">RemoveLogo</a>
<input name="dlView$ctl02$txtImage" type="text" value="asd.jpg" id="dlView_ctl02_txtImage" />
<input type="hidden" name="dlView$ctl02$hdnImage" id="dlView_ctl02_hdnImage" value="asd.jpg" />
</td>
</tr>
</td>
</tr><tr>
<td>
<tr>
<td>
<img id="dlView_ctl03_imgPlan" src="../SiteImages/vidhya/40/1/ThumbNails/vini.jpg" style="border-width:0px;" />
</td>
</tr>
<tr>
<td>
<a onclick="javascript:showLayerUpLoad();return false;" id="dlView_ctl03_lnkChangeLogo" href="javascript:__doPostBack('dlView$ctl03$lnkChangeLogo','')">ChangeLogo</a>
<br />
<a onclick="javascript:ConfirmChoice();return false;" id="dlView_ctl03_lnkRemoveLogo" href="javascript:__doPostBack('dlView$ctl03$lnkRemoveLogo','')">RemoveLogo</a>
<input name="dlView$ctl03$txtImage" type="text" value="vini.jpg" id="dlView_ctl03_txtImage" />
<input type="hidden" name="dlView$ctl03$hdnImage" id="dlView_ctl03_hdnImage" value="vini.jpg" />
</td>
</tr>
</td>
</tr><tr>
<td>
<tr>
<td>
<img id="dlView_ctl04_imgPlan" src="../SiteImages/vidhya/40/1/ThumbNails/" style="border-width:0px;" />
</td>
</tr>
<tr>
<td>
<a onclick="javascript:showLayerUpLoad();return false;" id="dlView_ctl04_lnkChangeLogo" href="javascript:__doPostBack('dlView$ctl04$lnkChangeLogo','')">ChangeLogo</a>
<br />
<a onclick="javascript:ConfirmChoice();return false;" id="dlView_ctl04_lnkRemoveLogo" href="javascript:__doPostBack('dlView$ctl04$lnkRemoveLogo','')">RemoveLogo</a>
<input name="dlView$ctl04$txtImage" type="text" id="dlView_ctl04_txtImage" />
<input type="hidden" name="dlView$ctl04$hdnImage" id="dlView_ctl04_hdnImage" />
</td>
</tr>
</td>
</tr><tr>
<td>
<tr>
<td>
<img id="dlView_ctl05_imgPlan" src="../SiteImages/vidhya/40/1/ThumbNails/adf.jpg" style="border-width:0px;" />
</td>
</tr>
<tr>
<td>
<a onclick="javascript:showLayerUpLoad();return false;" id="dlView_ctl05_lnkChangeLogo" href="javascript:__doPostBack('dlView$ctl05$lnkChangeLogo','')">ChangeLogo</a>
<br />
<a onclick="javascript:ConfirmChoice();return false;" id="dlView_ctl05_lnkRemoveLogo" href="javascript:__doPostBack('dlView$ctl05$lnkRemoveLogo','')">RemoveLogo</a>
<input name="dlView$ctl05$txtImage" type="text" value="adf.jpg" id="dlView_ctl05_txtImage" />
<input type="hidden" name="dlView$ctl05$hdnImage" id="dlView_ctl05_hdnImage" value="adf.jpg" />
</td>
</tr>
</td>
</tr><tr>
<td>
<tr>
<td>
<img id="dlView_ctl06_imgPlan" src="../SiteImages/vidhya/40/1/ThumbNails/" style="border-width:0px;" />
</td>
</tr>
<tr>
<td>
<a onclick="javascript:showLayerUpLoad();return false;" id="dlView_ctl06_lnkChangeLogo" href="javascript:__doPostBack('dlView$ctl06$lnkChangeLogo','')">ChangeLogo</a>
<br />
<a onclick="javascript:ConfirmChoice();return false;" id="dlView_ctl06_lnkRemoveLogo" href="javascript:__doPostBack('dlView$ctl06$lnkRemoveLogo','')">RemoveLogo</a>
<input name="dlView$ctl06$txtImage" type="text" id="dlView_ctl06_txtImage" />
<input type="hidden" name="dlView$ctl06$hdnImage" id="dlView_ctl06_hdnImage" />
</td>
</tr>
</td>
</tr><tr>
<td>
<tr>
<td>
<img id="dlView_ctl07_imgPlan" src="../SiteImages/vidhya/40/1/ThumbNails/" style="border-width:0px;" />
</td>
</tr>
<tr>
<td>
<a onclick="javascript:showLayerUpLoad();return false;" id="dlView_ctl07_lnkChangeLogo" href="javascript:__doPostBack('dlView$ctl07$lnkChangeLogo','')">ChangeLogo</a>
<br />
<a onclick="javascript:ConfirmChoice();return false;" id="dlView_ctl07_lnkRemoveLogo" href="javascript:__doPostBack('dlView$ctl07$lnkRemoveLogo','')">RemoveLogo</a>
<input name="dlView$ctl07$txtImage" type="text" id="dlView_ctl07_txtImage" />
<input type="hidden" name="dlView$ctl07$hdnImage" id="dlView_ctl07_hdnImage" />
</td>
</tr>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><strong style="color:#ADADAD">URL : </strong><a id="lnkUrl" target="_blank">
<span id="lblUrl"></span>
</a></td>
</tr>
</table>
<div>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWIwKerOHHCALt3oXMAwKQ9M/rBQLf8c7OBALF9uAaAtzO1PIKAt/2m70CAvrasL4HAuDf6ooCAtzOwPcIAt/2h0IC5v+70Q0CzITOxQ8C3M6spAcC3/bDxwYCgemdpAkC5+3XyA0C3M6YqQUC3/avzAQClcS6vQkC+8jMiQUC3M6EhgMC3/bL0AoCsK2c6A4ClrLWtAkC3M7wigEC3/b3hwQCnNKn+wQCgte57wYC3M7ctw8C3/bz2g4C3/GapA8CxfbUyAMC3M6I7wgC3/bf3ww=" />
</div></form>
</body>
</html>
For the OnClientClick property on button server controls (ImageButton, LinkButton, Button) you do not use the javascript: prefix. So try to remove all your javascript: stuff and see if it works.
Ignored what I said above... LinkButton is a special case. :P
I now have a closer look at your code and the HTML output. From what I can see, there are some issues in your code:
You are dynamically changing the OnClientClick property of the btnUpload server control which sits outside the DataList. Which means the OnClientClick for the btnUpload button will change each time an item is bound to the list and the result is, if it works, the last ImageName in your datasource is passed to the btnUpload's onclick attribute in the output HTML.
The Eval("ImageName") seems only work when calling it from the GetImage() function for imgPlan. I am not too sure why this is happening. And because of this, the Text and Value of txtImage and hdnImage are not populated and this is why you did not get the value in the js.
Please review your code and let us know any results. :)
btnUpload it outside the item template for your datalast, so OnClientClick is rewritten for every item during the ItemDataBound handler. apparently for the last item in your datasource, ImageName is empty/null. move btnUpload into the item template and see if that improves the situation.

Resources