Why I can't click on the ImageButton in ListView? - c#

I want to use the listview control in my asp.net application and I use in the itemtemplate imagebuttons. I want if I click on this Button than I can make a div block visible = true and fill the controls with the data from the listview row.
my listview:
<asp:ListView runat="server" ID="myListView" OnItemCommand="myListView_ItemCommand"
OnSelectedIndexChanging="myListView_SelectedIndexChanging">
<LayoutTemplate>
<table id="UserList" border="1" cellpadding="0" cellspacing="0">
<tr style="background-color:#ccdaeb">
<th>
<span class="spanpading"><asp:Label ID="lblNameHeader" runat="server" Text="_Name"></asp:Label></span> </th>
<th>
<span class="spanpading"><asp:Label ID="lblCompanyHeader" runat="server" Text="_Firma"></asp:Label></span></th>
<th >
<span class="spanpading"><asp:Label ID="lblVonHeader" runat="server" Text="_gültig ab"></asp:Label></span></th>
<th >
<span class="spanpading"><asp:Label ID="lblBisHeader" runat="server" Text="_gültig bis"></asp:Label></span></th>
<th >
<span class="spanpading"><asp:Label ID="lblErstellerHeader" runat="server" Text="_erstellt von"></asp:Label></span> </th>
<th align="left">
</th>
<th align="left">
</th>
<th align="left">
</th>
</tr>
<tr id="itemPlaceholder" runat="server"></tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr onmouseover="this.style.backgroundColor='#87CEFA'"
onmouseout="this.style.backgroundColor='#ffffff'">
<td align="left"><span class="spanpading"><asp:Label ID="lblname" Text='<%# Eval("NAME") %>' runat="server" /></span></td>
<td align="left"><span class="spanpading"><asp:Label ID="lblcompany" Text='<%# Eval("COMPANY") %>' runat="server" /></span></td>
<td align="left"><span class="spanpading"><asp:Label ID="lblVon" Text='<%# Eval("TIMEFROM") %>' runat="server" /></span></td>
<td align="left"><span class="spanpading"><asp:Label ID="lblBis" Text='<%# Eval("TIMETO") %>' runat="server" /></span></td>
<td align="left"><span class="spanpading"><asp:Label ID="lblErsteller" Text='<%# Eval("CREATOR") %>' runat="server" /></span></td>
<td align="left"><asp:ImageButton ID="imgDelete" runat="server" ToolTip="löschen" ImageUrl="images/delete.gif" /></td>
<td align="left"><asp:ImageButton ID="imgUpdate" runat="server" ToolTip="ändern" ImageUrl="images/edit.gif" CommandName="update" CommandArgument='<%# Container.DataItemIndex %>' /></td>
<td align="left"><asp:ImageButton ID="imgEmail" runat="server" ToolTip="Zugangsdaten senden" ImageUrl="images/send.gif" /></td>
</tr>
</ItemTemplate>
<EmptyDataTemplate>
<h4>Es wurden keine Einträge gefunden</h4><br/>
</EmptyDataTemplate>
<AlternatingItemTemplate>
<tr style="background-color: #E5EDF5;" onmouseover="this.style.backgroundColor='#87CEFA'"
onmouseout="this.style.backgroundColor='#E5EDF5'">
<td align="left"><span class="spanpading"><asp:Label ID="lblname" Text='<%# Eval("NAME") %>' runat="server" /></span></td>
<td align="left"><span class="spanpading"><asp:Label ID="lblcompany" Text='<%# Eval("COMPANY") %>' runat="server" /></span></td>
<td align="left"><span class="spanpading"><asp:Label ID="lblVon" Text='<%# Eval("TIMEFROM") %>' runat="server" /></span></td>
<td align="left"><span class="spanpading"><asp:Label ID="lblBis" Text='<%# Eval("TIMETO") %>' runat="server" /></span></td>
<td align="left"><span class="spanpading"><asp:Label ID="lblErsteller" Text='<%# Eval("CREATOR") %>' runat="server" /></span></td>
<td align="left"><asp:ImageButton ID="imgDelete" runat="server" ToolTip="löschen" ImageUrl="images/delete.gif" /></td>
<td align="left"><asp:ImageButton ID="imgUpdate" runat="server" ToolTip="ändern" ImageUrl="images/edit.gif" CommandName="update" CommandArgument='<%# Container.DataItemIndex %>' /></td>
<td align="left"><asp:ImageButton ID="imgEmail" runat="server" ToolTip="Zugangsdaten senden" ImageUrl="images/send.gif" /></td>
</tr>
</AlternatingItemTemplate>
</asp:ListView>
Here is m< code for the commandItem:
protected void myListView_SelectedIndexChanging(object sender, EventArgs e)
{
//
}
protected void myListView_ItemCommand(object sender, ListViewCommandEventArgs e)
{
if (e.CommandName == "update")
{
int index = Convert.ToInt32(e.CommandArgument);
Label lbName = (Label)myListView.Items[index].FindControl("lblname");
Label lbFirma = (Label)myListView.Items[index].FindControl("lblcompany");
Label lbVon = (Label)myListView.Items[index].FindControl("lblVon");
Label lbBis = (Label)myListView.Items[index].FindControl("lblBis");
//Übergabe an die Div Update Box
draggablebox.Visible = true;
}
}
and here is the errormessage:

Related

ASP.NET - How to create radio button maxtrix

I want create a radio button maxtrix like below picture!
I was tried use Repeate, but data is different between row and column. So i can't set datasource for repeater. Have way to group 2 list, and set datasource for Repeater, show data int Repeater by call Eval("row"), Eval("column") and Eval("mark")
var lstMatrixAnswer = JsonConvert.DeserializeObject<Answer>(json); //Get from json format
var row = lstMatrixAnswer.row.Select(p => p.row).ToList(); //Row datasource
var col= lstMatrixAnswer.column.Select(p => p.answer + "///" + p.mark).ToList(); //Column datasource (i want radio values is "mark")
public class AnswerCol
{
public string answer { get; set; }
public int mark { get; set; }
}
public class AnswerRow
{
public string row { get; set; }
}
public class Answer
{
public List<AnswerRow> row { get; set; }
public List<AnswerCol> column { get; set; }
}
//This is repeater, but i make sure it is impossible.
<asp:Repeater ID="rptAnswer" runat="server">
<HeaderTemplate>
<table class="table table-striped table-hover table-bordered dataTable" id="tblObject">
<thead>
<th style="vertical-align: middle"><%#Eval("col")%></th>
</thead>
<tbody>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%#Eval("answer") %>
</td>
<td>
<input id="Radio1" type="radio" runat="server" value='<%#Eval("mark") %>' />
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</tbody>
</table>
</FooterTemplate>
</asp:Repeater>
== Thank for reading ==
I did something like this way way back only using asp.net and javascript
Here i am posting only a little part , hope its enough for you to keep things going
<table width="100%" style="border-collapse:collapse;text-align:center" cellpadding="2" border="0" class="qoptions">
<tr style="font-weight:bold">
<td align="left" width="15%">Function</td>
<td style="color:#b91d47; font-size:large;font-weight:bold; text-align:center">Highly Dissatisfied</td>
<td style="color:#b91d47; font-size:large;font-weight:bold; text-align:center">Dissatisfied</td>
<td style="color:#b91d47; font-size:large;font-weight:bold; text-align:center">Satisfied</td>
<td style="color:#b91d47; font-size:large;font-weight:bold; text-align:center">Highly Satisfied</td>
<td style="font-weight:bold;" align="right"><span style="padding-right:75px">Comments <span class="instructions">(optional)</span></span></td>
</tr>
<tr style="background-color:#FDE6EA" id="BST"> <%--id="F0Q1"--%>
<td align="left" id="F0Name" >BST</td>
<td><asp:RadioButton ID="rbQ1F0_1" runat="server" GroupName="Q1F0" /></td>
<td><asp:RadioButton ID="rbQ1F0_2" runat="server" GroupName="Q1F0" /></td>
<td ><asp:RadioButton ID="rbQ1F0_3" runat="server" GroupName="Q1F0" /></td>
<td><asp:RadioButton ID="rbQ1F0_4" runat="server" GroupName="Q1F0" /></td>
<td align="right"><asp:TextBox ID="txtQ1F0" runat="server" TextMode="MultiLine" Rows="2" Columns="35" onKeyUp="javascript:Count(this);" onChange="javascript:Count(this);" /> </td>
<asp:HiddenField runat="server" ID="Q1F0Val" Value="" />
</tr>
<tr class="altrow" id="F1Q2">
<td align="left" id="F1Name">F1</td>
<td><asp:RadioButton ID="Q2F1_1" runat="server" GroupName="Q2F1" /></td>
<td><asp:RadioButton ID="Q2F1_2" runat="server" GroupName="Q2F1" /></td>
<td ><asp:RadioButton ID="Q2F1_3" runat="server" GroupName="Q2F1" /></td>
<td><asp:RadioButton ID="Q2F1_4" runat="server" GroupName="Q2F1" /></td>
<td align="right"><asp:TextBox ID="txtQ2F1" runat="server" TextMode="MultiLine" Rows="2" Columns="35" onKeyUp="javascript:Count(this);" onChange="javascript:Count(this);" /> </td>
<asp:HiddenField runat="server" ID="Q2F1Val" Value="" />
</tr>
<tr id="F2Q2">
<td align="left" id="F2Name" >F2</td>
<td><asp:RadioButton ID="Q2F2_1" runat="server" GroupName="Q2F2" /></td>
<td><asp:RadioButton ID="Q2F2_2" runat="server" GroupName="Q2F2" /></td>
<td><asp:RadioButton ID="Q2F2_3" runat="server" GroupName="Q2F2" /></td>
<td><asp:RadioButton ID="Q2F2_4" runat="server" GroupName="Q2F2" /></td>
<td align="right"><asp:TextBox ID="txtQ2F2" runat="server" TextMode="MultiLine" Rows="2" Columns="35" onKeyUp="javascript:Count(this);" onChange="javascript:Count(this);" /> </td>
<asp:HiddenField runat="server" ID="Q2F2Val" Value="" />
</tr>
<tr class="altrow" id="F3Q2">
<td align="left" id="F3Name" >F3</td>
<td><asp:RadioButton ID="Q2F3_1" runat="server" GroupName="Q2F3" /></td>
<td><asp:RadioButton ID="Q2F3_2" runat="server" GroupName="Q2F3" /></td>
<td><asp:RadioButton ID="Q2F3_3" runat="server" GroupName="Q2F3" /></td>
<td><asp:RadioButton ID="Q2F3_4" runat="server" GroupName="Q2F3" /></td>
<td align="right"><asp:TextBox ID="txtQ2F3" runat="server" TextMode="MultiLine" Rows="2" Columns="35" onKeyUp="javascript:Count(this);" onChange="javascript:Count(this);"/> </td>
<asp:HiddenField runat="server" ID="Q2F3Val" Value="" />
</tr>
<tr id="F4Q2">
<td align="left" id="F4Name" >F4</td>
<td><asp:RadioButton ID="Q2F4_1" runat="server" GroupName="Q2F4" /></td>
<td><asp:RadioButton ID="Q2F4_2" runat="server" GroupName="Q2F4" /></td>
<td><asp:RadioButton ID="Q2F4_3" runat="server" GroupName="Q2F4" /></td>
<td><asp:RadioButton ID="Q2F4_4" runat="server" GroupName="Q2F4" /></td>
<td align="right"><asp:TextBox ID="txtQ2F4" runat="server" TextMode="MultiLine" Rows="2" Columns="35" onKeyUp="javascript:Count(this);" onChange="javascript:Count(this);"/> </td>
<asp:HiddenField runat="server" ID="Q2F4Val" Value="" />
</tr>
<tr class="altrow" id="F5Q2">
<td align="left" id="F5Name" >F5</td>
<td><asp:RadioButton ID="Q2F5_1" runat="server" GroupName="Q2F5" /></td>
<td><asp:RadioButton ID="Q2F5_2" runat="server" GroupName="Q2F5" /></td>
<td><asp:RadioButton ID="Q2F5_3" runat="server" GroupName="Q2F5" /></td>
<td><asp:RadioButton ID="Q2F5_4" runat="server" GroupName="Q2F5" /></td>
<td align="right"><asp:TextBox ID="txtQ2F5" runat="server" TextMode="MultiLine" Rows="2" Columns="35" onKeyUp="javascript:Count(this);" onChange="javascript:Count(this);"/> </td>
<asp:HiddenField runat="server" ID="Q2F5Val" Value="" />
</tr>
<tr id="F6Q2">
<td align="left" id="F6Name" >F6</td>
<td><asp:RadioButton ID="Q2F6_1" runat="server" GroupName="Q2F6" /></td>
<td><asp:RadioButton ID="Q2F6_2" runat="server" GroupName="Q2F6" /></td>
<td><asp:RadioButton ID="Q2F6_3" runat="server" GroupName="Q2F6" /></td>
<td><asp:RadioButton ID="Q2F6_4" runat="server" GroupName="Q2F6" /></td>
<td align="right"><asp:TextBox ID="txtQ2F6" runat="server" TextMode="MultiLine" Rows="2" Columns="35" onKeyUp="javascript:Count(this);" onChange="javascript:Count(this);"/> </td>
<asp:HiddenField runat="server" ID="Q2F6Val" Value="" />
</tr>
<tr class="altrow" id="F7Q2">
<td align="left" id="F7Name" >F7</td>
<td><asp:RadioButton ID="Q2F7_1" runat="server" GroupName="Q2F7" /></td>
<td><asp:RadioButton ID="Q2F7_2" runat="server" GroupName="Q2F7" /></td>
<td><asp:RadioButton ID="Q2F7_3" runat="server" GroupName="Q2F7" /></td>
<td><asp:RadioButton ID="Q2F7_4" runat="server" GroupName="Q2F7" /></td>
<td align="right"><asp:TextBox ID="txtQ2F7" runat="server" TextMode="MultiLine" Rows="2" Columns="35" onKeyUp="javascript:Count(this);" onChange="javascript:Count(this);"/> </td>
<asp:HiddenField runat="server" ID="Q2F7Val" Value="" />
</tr>
<tr id="F8Q2">
<td align="left" id="F8Name" >F8</td>
<td><asp:RadioButton ID="Q2F8_1" runat="server" GroupName="Q2F8" /></td>
<td><asp:RadioButton ID="Q2F8_2" runat="server" GroupName="Q2F8" /></td>
<td><asp:RadioButton ID="Q2F8_3" runat="server" GroupName="Q2F8" /></td>
<td><asp:RadioButton ID="Q2F8_4" runat="server" GroupName="Q2F8" /></td>
<td align="right"><asp:TextBox ID="txtQ2F8" runat="server" TextMode="MultiLine" Rows="2" Columns="35" onKeyUp="javascript:Count(this);" onChange="javascript:Count(this);"/> </td>
<asp:HiddenField runat="server" ID="Q2F8Val" Value="" />
</tr>
</table>
Example : Q2F8_1 denote Question 2 function 8 and _1 is rating highly disatisfied.
you can use javascript to save 1 , 2 ,3 or 4 to in hidden field which will be your rating for a key .
Access those hidden fields in your c# code and play your code there

Decimal point in "Convert.ToInt" statement causing Format Error?

I have been following this tutorial to help me create a basic shopping basket. When trying to run the code with the below method added which should calculate the TotalPrice & TotalProducts of the basket on the OrderForm, I get the following error:
'System.FormatException' occurred in mscorlib.dll but was not handled in user code. Additional information: Input string was not in a correct format.
pointing at the line
long ProductPrice =
Convert.ToInt64(PriceLabel.Text) *
Convert.ToInt64(ProductQuantity.Text);
In the database, an example of a ProductPrice is "199.99" where as the tutorial only used whole numbers e.g. "199". I am not sure if this is what is causing the issue? If this is the case, how should the code below be modified to include the decimal point too?
I am new to coding, so this is really stressing me out, I really would appreciated some guideance/suggested code changes to overcome this issue
Thanks as ever guys!
private void UpdateTotalBill()
{
long TotalPrice = 0;
long TotalProducts = 0;
foreach (DataListItem item in dlBasketItems.Items)
{
//Finds the price label on pnlMyBasket
Label PriceLabel = item.FindControl("lblPrice") as Label;
//Finds the quantity text box on pnlMyBasket
TextBox ProductQuantity = item.FindControl("txtProductQuantity") as TextBox;
long ProductPrice = Convert.ToInt32(PriceLabel.Text) * Convert.ToInt32(ProductQuantity.Text);
TotalPrice = TotalPrice + ProductPrice;
TotalProducts = TotalProducts + Convert.ToInt32(ProductQuantity.Text);
}
txtTotalPrice.Text = Convert.ToString(TotalPrice);
txtTotalProducts.Text = Convert.ToString(TotalProducts);
}
pnlMyBasket
<asp:Panel ID="pnlMyBasket" runat="server" ScrollBars="Auto" Height="500px" BorderColor="Black" BorderStyle="Inset" BorderWidth="1px" Visible="false">
<table align="center" cellspacing="1">
<tr>
<td align="center" class="auto-style4">
<asp:Label ID="lblAvailableStockAlert" runat="server" ForeColor="Red" Font-Bold="true"></asp:Label>
<asp:DataList ID="dlBasketItems" runat="server" RepeatColumns="3" Font-Bold="False"
Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False"
Width="551px">
<ItemTemplate>
<div align="left">
<table cellspacing="1" style="border: 1px ridge #9900FF; text-align: center; width: 172px;">
<tr>
<td style="border-bottom-style: ridge; border-width: 1px; border-color: #000000">
<asp:Label ID="lblProductName" runat="server" Text='<%# Eval("ProductName")%>' Style="font-weight: 700"></asp:Label>
</td>
</tr>
<tr>
<td>
<img alt="" src='<%# Eval("ProductImageUrl") %>' runat="server" id="imgProductPhoto" style="border: ridge 1px black;
width: 157px; height: 130px;" />
</td>
</tr>
<tr>
<td>AvailableStock: <asp:Label ID="lblAvailableStock" runat="server" Text='<%# Eval("ProductStock") %>'
ToolTip="Available Stock" ForeColor="Red" Font-Bold="true"></asp:Label>
<br />
Price:<asp:Label ID="lblPrice" runat="server" Text='<%# Eval ("ProductPrice") %>'></asp:Label>
<br /> Quantity Required x
<asp:TextBox ID="txtProductQuantity" runat="server" Width="20px" Height="10px" MaxLength="2" OnTextChanged="txtProductQuantity_TextChanged" AutoPostBack="true" ></asp:TextBox>
<asp:HiddenField ID="hfProductID" runat="server" Value='<%# Eval("ProductID") %>' />
</td>
</tr>
<tr>
<td>
<hr /> <asp:Button ID="btnRemoveFromBasket" runat="server" CommandArgument='<%# Eval("ProductID") %>'
Text="Remove From Basket" Width="100%" BorderColor="Black" BorderStyle="Inset" BorderWidth="1px"
OnClick="btnRemoveFromBasket_Click" CausesValidation="false" />
</td>
</tr>
</table>
</div>
</ItemTemplate>
<ItemStyle Width="33%" />
</asp:DataList>
</td>
</tr>
</table>
</asp:Panel>
pnlOrderForm
<asp:Panel ID="pnlOrderForm" runat="server" ScrollBars="Auto" Height="500px" BorderColor="Black"
BorderStyle="Inset" BorderWidth="1px" Visible="false">
<table style="width: 258px;">
<tr>
<td align="left">
Name:
</td>
</tr>
<tr>
<td>
<asp:TextBox ID="txtCustomerName" runat="server" Width="231px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtCustomerName"
ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="left">
PhoneNo:
</td>
</tr
<tr>
<td>
<asp:TextBox ID="txtCustomerPhoneNo" runat="server" Width="231px" MaxLength="10"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtCustomerPhoneNo"
ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="left">
EmailID
</td>
</tr>
<tr>
<td>
<asp:TextBox ID="txtCustomerEmailID" runat="server" Width="231px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtCustomerEmailID"
ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="left">
Address
</td>
</tr>
<tr>
<td align="left">
<asp:TextBox ID="txtCustomerAddress" runat="server" Width="227px" Height="81px"
TextMode="MultiLine"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtCustomerAddress"
ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="left">
Total Products :
</td>
</tr>
<tr>
<td align="center">
<asp:TextBox ID="txtTotalProducts" runat="server" ReadOnly="True" Width="231px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtTotalProducts"
ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="left">
Total Price :
</td>
</tr>
<tr>
<td>
<asp:TextBox ID="txtTotalPrice" runat="server" ReadOnly="True" Width="231px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="txtTotalPrice"
ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="left">
Payment Mode:
</td>
</tr>
<tr>
<td align="left">
<asp:RadioButtonList ID="rblMethodOfPayment" runat="server">
<asp:ListItem Value="1" Selected="True">1. Collect & Pay In Store</asp:ListItem>
<asp:ListItem Value="2">2. Pay with card</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr>
<td>
<br />
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnPlaceOrder" runat="server" OnClick="btnPlaceOrder_Click" Style="font-weight: 700"
Text="PlaceOrder" Width="90px" />
</td>
</tr>
<tr>
<td>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtCustomerEmailID"
ErrorMessage="Please Enter Valid EmailId" ForeColor="Red" ValidationExpression="\w+([-+.']\w+)*#\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
</td>
</tr>
</table>
</asp:Panel>
I think you need to convert to decimal, then to long. Like this:
long ProductPrice;
try
{
// hey you never know, someone might just put in an int64 in that textbox!
ProductPrice = Convert.ToInt32(PriceLabel.Text) *
Convert.ToInt32(ProductQuantity.Text);
}
catch
{
decimal tempPrice = Convert.ToDecimal(PriceLabel.Text) *
Convert.ToDecimal(ProductQuantity.Text);
ProductPrice = Convert.ToInt64(tempPrice);
}
Most direct way to how you are currently doing:
var ProductPrice = Convert.ToDecimal(PriceLabel.Text) * Convert.ToDecimal(ProductQuantity.Text);
this will throw an exception if the value cannot be converted to a decimal. Decimal.TryParse() would be better.
https://msdn.microsoft.com/en-us/library/system.decimal.tryparse(v=vs.110).aspx

how to pop up two modalpopup in gridview

I want to pop up two modalpopup from a gridview. I searched online but couldn't find the exact answer. Any help is appreciated.
--------ModalPopupExtender1---------
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
BackgroundCssClass="ModalPopupBG" CancelControlID="btn_Cancel" Drag="true"
PopupControlID="Panel2" PopupDragHandleControlID="Panel2"
TargetControlID="btnNew">
</asp:ModalPopupExtender>
-----------------PopupControlID="Panel2--------------------------
<div id="Panel2" class="popupConfirmation">
<div class="popup_Container">
<div id="PopupHeader" class="popup_Titlebar">
<div class="TitlebarLeft">
<%--
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
--%>
Edit Customer
</div>
<!--
<div class="TitlebarRight" >
</div>
-->
</div>
<div>
<table bgcolor="#CCFFFF" cellpadding="0" cellspacing="2" width="100%">
<tr>
<td width="5%">
</td>
<td width="25%">
</td>
<td width="65%">
</td>
<td width="5%">
</td>
</tr>
<tr>
<td width="5%">
</td>
<td style="text-align: right" width="25%">
<asp:LabelID="lblName"runat="server"FontSize="11pt" Text="First Name:">
</asp:Label>
</td>
<td style="text-align: left" width="65%">
<asp:TextBox ID="txtFirstName" runat="server" Width="300px">
</asp:TextBox>
<asp:Label ID="lbl_ErrorName" runat="server" ForeColor="Red"
style="display:none" Text="*">
</asp:Label>
</td>
<td width="5%">
</td>
</tr>
<tr>
<td width="5%">
</td>
<td style="text-align: right" width="25%">
<asp:Label ID="lblName2" runat="server" Font-Size="11pt" Text="Second Name:">
</asp:Label>
</td>
<td style="text-align: left" width="65%">
<asp:TextBox ID="txtSecondName" runat="server" Width="300px">
</asp:TextBox>
</td>
<td width="5%">
</td>
</tr>
<%--
<tr>
<td width="5%">
</td>
<td style="text-align: right" width="45%">
<asp:Label ID="lblName0" runat="server" Font-Size="11pt" Text="City">
</asp:Label>
</td>
<td style="text-align: left" width="45%">
<asp:TextBox ID="txtCity" runat="server" Width="200px">
</asp:TextBox>
</td>
<td width="5%">
</td>
<td width="5%">
</td>
</tr>
<tr>
<td width="5%">
</td>
<td style="text-align: right" width="45%">
<asp:Label ID="lblName1" runat="server" Font-Size="11pt" Text="State">
</asp:Label>
</td>
<td style="text-align: left" width="45%">
<asp:TextBox ID="txtState" runat="server" Width="200px">
</asp:TextBox>
</td>
<td width="5%">
</td>
<td width="5%">
</td>
</tr>
--%>
<tr>
<td width="5%">
</td>
<td style="text-align: right" width="25%">
<asp:Label ID="lblAddress1" runat="server" Font-Size="11pt" Text="Address1:">
</asp:Label>
</td>
<td style="text-align: left" width="65%">
<asp:TextBox ID="txtAddress1" runat="server" Width="300px">
</asp:TextBox>
<asp:Label ID="lbl_ErrorAddress1" runat="server" ForeColor="Red"
style="display:none" Text="*">
</asp:Label>
</td>
<td width="5%">
</td>
</tr>
<%--
<tr>
<td width="5%">
</td>
<td style="text-align: right" width="45%">
<asp:Label ID="lblAddress2" runat="server" Font-Size="11pt" Text="Address2:">
</asp:Label>
</td>
<td style="text-align: left" width="45%">
<asp:TextBox ID="txtAddress2" runat="server" Width="200px">
</asp:TextBox>
</td>
<td width="5%">
</td>
<td width="5%">
</td>
</tr>
--%>
<tr>
<td width="5%">
</td>
<td style="text-align: right" width="25%">
<asp:Label ID="lblDOB" runat="server" Font-Size="11pt" Text="Phone">
</asp:Label>
</td>
<td style="text-align: left" width="65%">
<asp:TextBox ID="txtPhone" runat="server" Width="200px">
</asp:TextBox>
<%--
<asp:CalendarExtender ID="txt_DOB_CalendarExtender" runat="server"
TargetControlID="txt_DOB">
</asp:CalendarExtender>
--%>
<asp:Label ID="lblErrorDOB" runat="server" Font-Bold="True" ForeColor="Red"
style="display:none" Text="*">
</asp:Label>
</td>
<td width="5%">
</td>
</tr>
<tr>
<td width="5%">
</td>
<td style="text-align: right" width="25%">
<asp:Label ID="lblDOB0" runat="server" Font-Size="11pt" Text="Mobile">
</asp:Label>
</td>
<td style="text-align: left" width="65%">
<asp:TextBox ID="txtMobile" runat="server" Width="200px">
</asp:TextBox>
</td>
<td width="5%">
</td>
</tr>
<tr>
<td width="5%">
</td>
<td style="text-align: right" width="25%">
</td>
<td style="text-align: left" width="65%">
</td>
<td width="5%">
</td>
</tr>
</table>
</div>
<div align="center">
<asp:Button ID="btn_Update" runat="server"
Text="Save" Width="75px" onclick="btn_Update_Click" />
<asp:Button ID="btn_Cancel" runat="server" Text="Cancel" Width="75px" />
</div>
</div>
</div>
----------------`ModalpopUp`----------------------------
<asp:ModalPopupExtender ID="ModalPopUp" runat="server"
CancelControlID="idclose" Drag="true" DynamicServicePath="" Enabled="True"
PopupControlID="PartyCustomers_idbody"
PopupDragHandleControlID="PartyCustomers_IdTitle"
TargetControlID="btnShowPopup">
<Animations>
<OnShown><Fadein Duration="0.50" /></OnShown>
<OnHiding><Fadeout Duration="0.75" /></OnHiding>
</Animations>
</asp:ModalPopupExtender>
--------------------PartyCustomers_idbody : popupbody--------------
`<div id="PartyCustomers_idbody" runat="server" class="Common_divbody"
>
<div id="PartyCustomers_IdTitle" runat="server" class="Common_divtitle"
>
<div id="idclose" class="Common_close">
</div>
<div class="Common_divhr">
Booked Status</div>
</div>
<div class="ModalPopUpDiv">
<asp:Label ID="lblmessage1" runat="server" Text="Label"></asp:Label>
<asp:GridView ID="dgvSystemDetails" runat="server" AllowPaging="True"
AllowSorting="True" AlternatingRowStyle-CssClass="alt"
AutoGenerateColumns="False" CellSpacing="2" CssClass="mGrid" Font-Bold="True"
Font-Names="Arial" Font-Size="Small" PageSize="12"
Width="750px" DataKeyNames="SystemCode"
onrowdatabound="dgvSystemDetails_RowDataBound">
<AlternatingRowStyle CssClass="alt" />
<Columns>
<asp:BoundField DataField="RegistrationDate" DataFormatString="{0:d}"
HeaderText="Registration Date">
<HeaderStyle />
<ItemStyle />
</asp:BoundField>
<asp:BoundField DataField="SystemCode" HeaderText="System Code" />
<asp:BoundField DataField="Reg_Status" HeaderText="Reg. Status" />
<asp:BoundField DataField="Key" HeaderText="Key" />
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="btnBlock" runat="server" CssClass="Common_button"
Text="Block" onclick="btnBlock_Click" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>`
--------------------------------cs-: RowCommand---code--------------------------
protected void dgvActivatedCustomers_RowCommand1(object sender, GridViewCommandEventArgs e)
{
//Load System details gridview in modalpop up...
if(e.CommandName=="Select")
{
DataSet ds;
int RowIndex = Convert.ToInt32(e.CommandArgument);
long ProductSerialID = Convert.ToInt32(dgvActivatedCustomers.DataKeys[RowIndex].Values["ProductSerialID"]) ;
hdnProuductId.Value= dgvActivatedCustomers.DataKeys[RowIndex].Values["ProductSerialID"].ToString();
lblmessage1.Visible = true;
//string RegStatus = dgvSystemDetails.SelectedRow.Cells[2].Text;
string ProductSerial = dgvActivatedCustomers.Rows[RowIndex].Cells[6].Text;
string Reg_Status = LoadSystemDetails(ProductSerialID).Tables[0].Rows[0]["Reg_Status"].ToString();
lblmessage1.Text = "Activation Code :" + General.GetActivationCode(Convert.ToDouble(ProductSerial)).ToString();
LoadSystemDetails(ProductSerialID);
ds = LoadSystemDetails(ProductSerialID);
//filling data table
DataTable dt = (DataTable)dgvSystemDetails.DataSource;
//Add new columns to datatable
dt.Columns.Add("Key", typeof(System.Int64));
// get key for specific key by passing system code ot getRegistrationKey.
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
string SystemCode = ds.Tables[0].Rows[i]["SystemCode"].ToString();
//lblmessage2.Text = "Key :" + Registration.getRegistrationKey(SystemCode, ProductSerial);
string Key = Registration.getRegistrationKey(SystemCode, ProductSerial);
dt.Rows[i]["Key"] = Key;
}
Session["dgvSystemDetailsDataSource"] = dt;
dgvSystemDetails.DataSource = dt;
dgvSystemDetails.DataBind();
dgvSystemDetails.Visible = true;
if (Reg_Status == "Blocked")
{
lblmessage1.Visible = true;
lblmessage1.Text = "Blocked System";
//dgvSystemDetails.FindControl("btnBlock").Visible = false;
dgvSystemDetails.DataSource = Session["dgvSystemDetailsDataSource"];
dgvSystemDetails.DataBind();
ModalPopUp.Show();
}
ModalPopUp.Show();
}
}
description :btnclick second popup--------------
protected void Button1_Click(object sender, EventArgs e)
{
try
{
Button btn = (Button)sender;
GridViewRow row = (GridViewRow)btn.NamingContainer;
int rowno = row.RowIndex;
txtFirstName.Text = dgvActivatedCustomers.DataKeys[rowno].Values["CustomerName"].ToString();
txtSecondName.Text = dgvActivatedCustomers.DataKeys[rowno].Values["CustomerLName"].ToString();
txtAddress1.Text = (dgvActivatedCustomers.Rows[rowno].Cells[4].Text != " " ? dgvActivatedCustomers.Rows[rowno].Cells[4].Text : "");
txtPhone.Text = (dgvActivatedCustomers.Rows[rowno].Cells[2].Text != " " ? dgvActivatedCustomers.Rows[rowno].Cells[2].Text : "");
txtMobile.Text = (dgvActivatedCustomers.Rows[rowno].Cells[3].Text != " " ? dgvActivatedCustomers.Rows[rowno].Cells[3].Text : "");
hdnId.Value = dgvActivatedCustomers.DataKeys[rowno].Values["CustomerID"].ToString();
txtName.Text = (dgvDemoCust.SelectedRow != "") ? dgvDemoCust.SelectedRow.Cells[0].Text : "";
ModalPopupExtender1.Show();
}
catch (Exception ex) { }
}
Question : The first pop up is showing but the second one doesn't.....any body have any idea

button inside of ajax pannel didnot work in Google chrome and yandex and IE

The button click inside of Ajax update panel didn't work in Chrome and IE but it work in Firefox. I add files in this links.any one can help me? i will be glad. thanks
My Code Address -
Error Screen İmage
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table id="TblMain" cellspacing="0" cellpadding="0" width="100%" border="0">
<tr>
<td align="left">
<div class="module_box">
<asp:HyperLink ID="lnkUseCoupons" CssClass="lightbox addbutton" runat="server" NavigateUrl="/store/addcoupon.aspx"><%=GetGlobalResourceObject("lang", "AddCoupon")%></asp:HyperLink>
<div class="clear">
</div>
<asp:Label ID="lblCouponInfo" runat="server" EnableViewState="False"></asp:Label>
<asp:LinkButton ID="btnDeleteCoupon" runat="server" CssClass="deletebutton" Visible="False"><%=GetGlobalResourceObject("lang", "Delete")%></asp:LinkButton>
</div>
</td>
</tr>
<tr>
<td id="SepetlerContainer" runat="server">
<div class="module_box">
<label class="subtitle">
<%=GetGlobalResourceObject("lang", "Carts")%></label>
<table cellpadding="1" cellspacing="0" border="0" width="100%">
<tr>
<td colspan="2">
<div id="transferalert" visible="false" runat="server" class="alert">
<%=GetGlobalResourceObject("lang", "CartMsg5")%></div>
</td>
</tr>
<tr>
<td align="left">
<table id="TblSepetler" cellspacing="0" cellpadding="0" width="100%" border="0" runat="server">
<tr>
<td>
<%=GetGlobalResourceObject("lang", "SelectCart")%>
<asp:DropDownList ID="ddlSepet" runat="server" DataTextField="CartType" DataValueField="ShoppingCartDefId"
AutoPostBack="True">
</asp:DropDownList>
<asp:HyperLink ID="lnkaddnew" CssClass="addbutton lightbox" runat="server"><%=GetGlobalResourceObject("lang", "AddNew")%></asp:HyperLink>
<asp:HyperLink ID="lnkEdit" CssClass="editbutton lightbox" runat="server"><%=GetGlobalResourceObject("lang", "Edit")%></asp:HyperLink>
<asp:LinkButton ID="lnkDeleteCart" CssClass="deletebutton" runat="server"><%=GetGlobalResourceObject("lang", "Delete")%></asp:LinkButton>
</td>
</tr>
</table>
</td>
<td align="right">
<table id="TblTransfer" runat="server">
<tr>
<td>
<asp:Label ID="lblTr" runat="server"><%=GetGlobalResourceObject("lang", "SelectTargetCart")%></asp:Label>
<asp:DropDownList ID="ddlTransferSepet" runat="server" DataTextField="CartType" DataValueField="ShoppingCartDefId"
AutoPostBack="True">
</asp:DropDownList>
<asp:LinkButton ID="lnkTransfer" CssClass="transferbutton" runat="server"><%=GetGlobalResourceObject("lang", "TransferToCart")%></asp:LinkButton>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td id="SepetContainer" runat="server">
<div class="module_box">
<label>
<asp:Label ID="lblKampanya0" runat="server"></asp:Label></label>
<table id="TblSepet" cellspacing="0" cellpadding="2" width="100%" border="0">
<tr>
<td>
<asp:DataGrid ID="DataGrid0" runat="server" Width="100%" AutoGenerateColumns="False"
CellPadding="4" DataKeyField="Qty" CssClass="datalist" HeaderStyle-CssClass="title"
GridLines="none" ItemStyle-CssClass="row">
<Columns>
<asp:TemplateColumn Visible="False">
<ItemTemplate>
<asp:Label ID="ProductId" runat="server" Visible="False" Text='<%# Eval("ProductId") %>'> </asp:Label>
<asp:Label ID="RecordId" runat="server" Visible="False" Text='<%# Eval("RecordId") %>'> </asp:Label>
</ItemTemplate>
<HeaderStyle Width="0px"></HeaderStyle>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="<%$ Resources:lang, ProductCode%>" Visible="False">
<ItemTemplate>
<asp:HyperLink ID="Hyperlink2" runat="server" Text='<%# Eval("ProductCode") %>'
NavigateUrl='<%# String.Format(BaseUrl2() + "{0}" + ".aspx",Eval("Url").ToString().Remove(Eval("Url").ToString().Length - 1, 1)) %>'> </asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn ItemStyle-Width="80px" HeaderText="<%$ Resources:lang, ProductImage%>"
HeaderStyle-HorizontalAlign="Center">
<ItemStyle HorizontalAlign="Center" />
<ItemTemplate>
<img alt="" class="thumb" src='<%# "/store/makethumb.aspx?file=" + Eval("Path") + "&intSize=50" %>' />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="<%$ Resources:lang, ProductName%>">
<ItemTemplate>
<itemstyle wrap="False"></itemstyle>
<asp:HyperLink ID="Hyperlink7" runat="server" Text='<%# Eval("ProductName") %>'
NavigateUrl='<%# string.Format(BaseUrl2() + "{0}" + ".aspx",Eval("Url").ToString().Remove(Eval("Url").ToString().Length - 1, 1)) %>'> </asp:HyperLink>
<asp:Label ID="Hy7a" runat="server" Text='<%# Eval("Description").ToString().Replace(",","</br>") %>'></asp:Label>
<asp:HyperLink ID="Hyperlink1a6" Visible='<%# visible1(Eval("ProductId"))%>'
runat="server" NavigateUrl='<%# linkgen1() %> '> </asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="<%$ Resources:lang, Point%>">
<ItemTemplate>
<itemstyle wrap="False"></itemstyle>
<asp:Label ID="lblPuan" runat="server"> </asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="<%$ Resources:lang, Quantity%>">
<ItemStyle Wrap="False" Width="120" HorizontalAlign="left"></ItemStyle>
<ItemTemplate>
<asp:TextBox ID="Quantity" Enabled='<%# Interaction.IIf(Eval("ProductId").ToString().intyap() == tmpOrder.Campain.ProductId & tmpOrder.Campain.DiscountType == 2, false, true)%>'
runat="server" Text='<%# Eval("Qty") %>' MaxLength="4"
Columns="4"> </asp:TextBox>
<asp:Label ID="UnitId" runat="server" Visible="False" Text='<%# Eval("UnitId") %>'> </asp:Label>
<asp:Label runat="server" Text='<%# Eval("BirimAdi") %>' ID="Label18"> </asp:Label>
</ItemTemplate>
<HeaderStyle Wrap="False" HorizontalAlign="center"></HeaderStyle>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="<%$ Resources:lang, QtyPrice%>">
<ItemStyle Wrap="False" HorizontalAlign="Right"></ItemStyle>
<ItemTemplate>
<asp:Label runat="server" Text='<%# deger001(Convert.ToDecimal(Eval("Rate").ToString()),Convert.ToDecimal(Eval("Indirim").ToString()),Convert.ToDecimal(Eval("SatisFiyati").ToString()),Convert.ToDecimal(Eval("ValueAdd").ToString()),Convert.ToDecimal(Eval("qty").ToString()),Convert.ToInt32(Eval("ProductId").ToString()))%>'
ID="Label9" name="Label9"> </asp:Label>
</ItemTemplate>
<HeaderStyle Wrap="False" HorizontalAlign="Right"></HeaderStyle>
</asp:TemplateColumn>
<asp:BoundColumn DataField="KdvRate" DataFormatString="%{0:0}" HeaderText="<%$ Resources:lang, TaxRate%>">
<ItemStyle Wrap="False" HorizontalAlign="Right"></ItemStyle>
<HeaderStyle Wrap="False" HorizontalAlign="Right"></HeaderStyle>
</asp:BoundColumn>
<asp:TemplateColumn HeaderText="<%$ Resources:lang, PiceWithoutTax%>">
<ItemStyle Wrap="False" HorizontalAlign="Right"></ItemStyle>
<ItemTemplate>
<asp:Label ID="Label12" runat="server" Text='<%# deger002(Convert.ToDecimal(Eval("Rate").ToString()),Convert.ToDecimal(Eval("Indirim").ToString()),Convert.ToDecimal(Eval("SatisFiyati").ToString()),Convert.ToDecimal(Eval("ValueAdd").ToString()),Convert.ToDecimal(Eval("qty").ToString()),Convert.ToInt32(Eval("ProductId").ToString())) %>'> </asp:Label>
</ItemTemplate>
<HeaderStyle Wrap="False" HorizontalAlign="Right"></HeaderStyle>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="<%$ Resources:lang, Selection%>">
<ItemStyle HorizontalAlign="Justify"></ItemStyle>
<ItemTemplate>
<center>
<asp:CheckBox ID="Remove" runat="server"></asp:CheckBox>
</center>
</ItemTemplate>
<HeaderStyle Wrap="False"></HeaderStyle>
</asp:TemplateColumn>
<asp:BoundColumn DataField="Barcode" HeaderText="<%$ Resources:lang, Barcode%>" Visible="false">
</asp:BoundColumn>
</Columns>
</asp:DataGrid>
</td>
</tr>
<tr>
<td>
<div id="stokalert" visible="false" runat="server" class="alert">
<asp:Label ID="lblStokError" runat="Server" EnableViewState="False"></asp:Label></div>
</td>
</tr>
<tr>
<td align="right">
<asp:LinkButton ID="lnkUpdate" runat="server" CssClass="savebutton"><%= GetGlobalResourceObject("lang", "Update")%></asp:LinkButton>
<asp:LinkButton ID="lnkDelete" runat="server" CssClass="deletebutton"><%= GetGlobalResourceObject("lang", "Delete")%></asp:LinkButton>
</td>
</tr>
<tr>
<td>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td align="left">
<asp:DataList ID="dlCargoList" runat="server" RepeatDirection="vertical">
<HeaderTemplate>
<b>
<%=GetGlobalResourceObject("lang", "ShippingPrice")%></b></HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblCargoName" runat="server" Text='<%# Eval("CargoName") %>'></asp:Label>:
<asp:Label ID="lblCargoText" runat="server" Text='<%# publicItems.CurrencySymbolLeft + " " + publicItems.formatCurDoviz(Convert.ToDecimal(Eval("CargoPrice").ToString()) * (publicItems.DefaultCurrencyRate /publicItems. CurrencyRate))+ " " + publicItems.CurrencySymbolRight %>'></asp:Label>
</ItemTemplate>
</asp:DataList>
</td>
<td align="right">
<table id="tblfy" cellspacing="0" cellpadding="2" border="0" runat="server">
<tr>
<td align="right">
<asp:Label ID="lblAgirlik" runat="server" Visible="False"><%=GetGlobalResourceObject("lang", "TotalHeight")%>:</asp:Label>
</td>
<td align="right">
<asp:Label ID="lblToplamAgirlik" runat="server" Visible="False"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="lblHacim" runat="server" Visible="False"><%=GetGlobalResourceObject("lang", "TotalVolume")%>:</asp:Label>
</td>
<td align="right">
<asp:Label ID="lblToplamHacim" runat="server" Visible="False"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="lblIndirim" runat="server" Visible="False"><%=GetGlobalResourceObject("lang", "TotalDiscount")%>:</asp:Label>
</td>
<td align="right">
<asp:Label ID="lblToplamIndirim" runat="server" Visible="False"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="Label2" runat="server"><%=GetGlobalResourceObject("lang", "TotalProductsPrice")%>:</asp:Label>
</td>
<td align="right">
<asp:Label ID="lblToplamTutar" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="Label6" runat="server"><%=GetGlobalResourceObject("lang", "TotalTax")%>:</asp:Label>
</td>
<td align="right">
<asp:Label ID="lblToplamKdv" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="lblAraToplam" runat="server"><%=GetGlobalResourceObject("lang", "SubTotal")%>:</asp:Label>
</td>
<td align="right">
<asp:Label ID="lblToplamAraToplam" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="lblCekTutari" runat="server" Visible="False"><%=GetGlobalResourceObject("lang", "CouponDiscount")%>:</asp:Label>
</td>
<td align="right">
<asp:Label ID="lblToplamCekTutari" runat="server" Visible="False"></asp:Label>
</td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:Label ID="lblSepetSeperator1" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="Label7" runat="server"><%=GetGlobalResourceObject("lang", "TotalWithTax")%>:</asp:Label>
</td>
<td align="right">
<asp:Label ID="lblKdvDahilToplam" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="lblHavale" runat="server"><%=GetGlobalResourceObject("lang", "TotalWithTransfer")%>:</asp:Label>
</td>
<td align="right">
<asp:Label ID="lblKdvDahilHavale" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="lblKKTek" runat="server"><%=GetGlobalResourceObject("lang", "TotalWithCreditCart")%>:</asp:Label>
</td>
<td align="right">
<asp:Label ID="lblKdvDahilKK" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:Label ID="lblSepetSeperator2" runat="server"></asp:Label>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td align="right">
<table id="Table6" cellspacing="0" cellpadding="0" width="100%" border="0">
<tr>
<td id="Td7" runat="server">
</td>
<td id="Td8" runat="server">
</td>
<td id="Td9" runat="server">
</td>
</tr>
</table>
<table cellpadding="0">
<tr>
<td>
<asp:LinkButton ID="btnMailOrder" CssClass="button" runat="server" Visible="False"><%=GetGlobalResourceObject("lang", "Buy")%></asp:LinkButton>
</td>
<td>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<div id="cartalert" visible="false" runat="server" class="alert">
<asp:Label ID="lblcartError" runat="Server" EnableViewState="False"></asp:Label></div>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
Why you are attaching the events in the code behind?
Try change this line:
<asp:LinkButton ID="lnkDeleteCart" CssClass="deletebutton" runat="server"><%=GetGlobalResourceObject("lang", "Delete")%></asp:LinkButton>
To this:
<asp:LinkButton ID="lnkDeleteCart" CssClass="deletebutton" runat="server" OnClick="lnkDelete_Click"><%=GetGlobalResourceObject("lang", "Delete")%></asp:LinkButton>
And comment these lines on your code-behind:
EventHandler handler = new EventHandler(this.lnkDelete_Click);
if (this.lnkDelete != null)
{
this.lnkDelete.Click -= handler;
}
if (this.lnkDelete != null)
{
this.lnkDelete.Click += handler;
}
I made the change only on the delete button, you probably need to change others too ...

how find and give css class to a control in side layout template of listview?

I have a listview control and in layout template, i have linkbuttons. Now what i want to do. i have a span with each linkbutton. i want to give css class while we click on linkbutton. my html code is as follow:
<asp:ListView ID="lst_CallType" runat="server" ItemPlaceholderID="tr" OnItemDataBound="lst_CallType_ItemDataBound">
<LayoutTemplate>
<table cellspacing="0">
<tr class="hdrRowColor1">
<td align="left" width="500px">
<asp:LinkButton ID="lnk_Name" runat="server" ValidationGroup="vgSearch" OnClientClick="changeSortState();"
CommandArgument="tblCallTypenew.CallType" OnClick="lnk_Sort">Name</asp:LinkButton>
<span id="imgSortPosition" class="sortNotSelected"></span>
</td>
<td align="left" width="80px">
<asp:LinkButton ID="lnk_Status" runat="server" CommandArgument="tblCallTypenew.isactive"
ValidationGroup="vgSearch" OnClick="lnk_Sort">Status</asp:LinkButton>
<span id="Span1" class="sortNotSelected"></span>
</td>
<td align="left" width="200px">
<asp:LinkButton ID="lnk_CreatedOn" runat="server" CommandArgument="tblCallTypenew.CreatedDate"
ValidationGroup="vgSearch" OnClick="lnk_Sort">Created On</asp:LinkButton>
<span id="Span2" class="sortNotSelected"></span>
</td>
<td align="left" width="200px">
<asp:LinkButton ID="lnk_LastModfiedOn" runat="server" CommandArgument="tblCallTypenew.ModifiedDate"
ValidationGroup="vgSearch" OnClick="lnk_Sort">Last Modified On</asp:LinkButton>
<span id="Span3" class="sortNotSelected"></span>
</td>
<td align="left" width="200px">
<asp:LinkButton ID="lnk_CreatedBy" runat="server" CommandArgument="tblUserNew.FirstName"
ValidationGroup="vgSearch" OnClick="lnk_Sort">Created By</asp:LinkButton>
<span id="Span4" class="sortNotSelected"></span>
</td>
<td align="left" width="200px">
<%--<asp:LinkButton ID="lnkCreatedDate" runat="server" CommandArgument="tblUserActivities.CreatedDate"
OnClick="lnk_Sort">Created Date</asp:LinkButton>--%>
<asp:LinkButton ID="lnk_LastModfiedBy" runat="server" CommandArgument="v.FirstName"
ValidationGroup="vgSearch" OnClick="lnk_Sort">Modified By</asp:LinkButton>
<span id="Span5" class="sortNotSelected"></span>
</td>
<td align="left" style="border-right: 1px solid #6398cc">
Activity
<div style="width: 50px; float: right;">
</div>
</td>
</tr>
<tr id="tr" runat="server">
</tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr class='<%# Convert.ToBoolean(Container.DataItemIndex % 2) ? "EvenRowColor" : "OddRowColor" %>'>
<td align="left">
<asp:Label ID="lblDeptId" runat="server" Text='<%# Eval("ID")%>' Visible="false"></asp:Label>
<%# Eval("Calltype")%>
</td>
<td align="left">
<asp:Label ID="lbl_Status" runat="server" Style="display: none;" Text='<%# Eval("IsActive")%>'></asp:Label>
<asp:ImageButton ID="imgbtnStatus" runat="server" CommandArgument='<%# Eval("id") %>'
OnClick="imgbtnStatus_Onclick" />
</td>
<td align="left">
<%# Eval("CreatedDate")%>
</td>
<td align="left">
<%# Eval("ModifiedDate") %>
</td>
<td align="left">
<%# Eval("CreatedBy")%>
</td>
<td align="left">
<%# Eval("ModifiedBy")%>
</td>
<td>
<asp:Label ID="lblCallType" runat="server" Style="display: none;" Text='<%# Eval("Calltype")%>'></asp:Label>
<asp:ImageButton ID="imgbtnEdit" runat="server" ImageUrl="~/App_Themes/ThemeNew/Images/edit.png"
ToolTip="Edit Details" CommandArgument='<%# Eval("ID") %>' OnClick="imgbtnEdit_OnClick" />
<asp:ImageButton ID="imgbtnDelete" runat="server" ImageUrl="~/App_Themes/ThemeNew/Images/delete.png"
ToolTip="Delete" Style="display: none;" CommandArgument='<%# Eval("id") %>' OnClientClick="return confirm('Are you sure you want to delete the Call type?');"
OnClick="imgbtnDelete_OnClick" />
</td>
</tr>
</ItemTemplate>
</asp:ListView>
Actually i want to show sort images while user click on linkbuttons.And i want to do it by code behind.
My .cs code is as follow:
protected void lnk_Sort(object sender, EventArgs e)
{
LinkButton lnk = (LinkButton)sender;
string arg = lnk.CommandArgument.ToString();
ViewState["sortCol"] = arg;
GetSortDirection();
BindData(ViewState["sortCol"].ToString(), ViewState["sortDir"].ToString(), Convert.ToInt32(ViewState["nmbr"]), Pager.PageSize);
}
private void GetSortDirection()
{
if (Convert.ToString(ViewState["sortDir"]) == "Desc")
{
ViewState["sortDir"] = "asc";
}
else
{
ViewState["sortDir"] = "Desc";
}
}
You can do a findcontrol in Listview_sorting event
i have done it with a silly trick
my html code is:
<asp:ListView ID="lst_CallType" runat="server" ItemPlaceholderID="tr" OnItemDataBound="lst_CallType_ItemDataBound">
<LayoutTemplate>
<table cellspacing="0">
<tr class="hdrRowColor1">
<td width="35px" align="left">
S.No
</td>
<td align="left" width="300px">
<asp:LinkButton ID="lnk_Name" runat="server" ValidationGroup="vgSearch" CommandArgument="tblCallTypenew.CallType"
OnClick="lnk_Sort">Name</asp:LinkButton>
<asp:Image ID="img_lnk_Name" Visible="false" runat="server" />
</td>
<td align="left" width="150px">
<asp:LinkButton ID="lnk_CreatedBy" runat="server" CommandArgument="tblUserNew.FirstName"
ValidationGroup="vgSearch" OnClick="lnk_Sort">Created By</asp:LinkButton>
<asp:Image ID="img_lnk_CreatedBy" Visible="false" runat="server" />
</td>
<td align="left" width="120px">
<asp:LinkButton ID="lnk_CreatedOn" runat="server" CommandArgument="tblCallTypenew.CreatedDate"
ValidationGroup="vgSearch" OnClick="lnk_Sort">Created On</asp:LinkButton>
<asp:Image ID="img_lnk_CreatedOn" Visible="false" runat="server" />
</td>
<td align="left" width="150px">
<%--<asp:LinkButton ID="lnkCreatedDate" runat="server" CommandArgument="tblUserActivities.CreatedDate"
OnClick="lnk_Sort">Created Date</asp:LinkButton>--%>
<asp:LinkButton ID="lnk_LastModfiedBy" runat="server" CommandArgument="v.FirstName"
ValidationGroup="vgSearch" OnClick="lnk_Sort">Last Modified By</asp:LinkButton>
<asp:Image ID="img_lnk_LastModfiedBy" Visible="false" runat="server" />
</td>
<td align="left" width="120px">
<asp:LinkButton ID="lnk_LastModfiedOn" runat="server" CommandArgument="tblCallTypenew.ModifiedDate"
ValidationGroup="vgSearch" OnClick="lnk_Sort">Last Modified On</asp:LinkButton>
<asp:Image ID="img_lnk_LastModfiedOn" Visible="false" runat="server" />
</td>
<td align="center" width="55px">
<asp:LinkButton ID="lnk_Status" runat="server" CommandArgument="tblCallTypenew.isactive"
ValidationGroup="vgSearch" OnClick="lnk_Sort">Status</asp:LinkButton>
<asp:Image ID="img_lnk_Status" Visible="false" runat="server" />
</td>
<td align="center" width="50px" style="border-right: 1px solid #6398cc">
Activity
<%-- <div style="width: 50px; float: right;">
</div>--%>
</td>
</tr>
<tr id="tr" runat="server">
</tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr class='<%# Convert.ToBoolean(Container.DataItemIndex % 2) ? "EvenRowColor" : "OddRowColor" %>'>
<td align="left" valign="middle">
<%# Container.DataItemIndex+1 %>.
</td>
<td align="left">
<asp:Label ID="lblDeptId" runat="server" Text='<%# Eval("ID")%>' Visible="false"></asp:Label>
<%# Eval("Calltype")%>
</td>
<td align="left">
<%# Eval("CreatedBy")%>
</td>
<td align="left">
<%# Convert.ToDateTime(Eval("CreatedDate")).ToString("MMM dd, yyyy")%>
</td>
<td align="left">
<%# Eval("ModifiedBy")%>
</td>
<td align="left">
<%# Convert.ToDateTime(Eval("ModifiedDate")).ToString("MMM dd, yyyy")%>
</td>
<td align="center">
<asp:Label ID="lbl_Status" runat="server" Style="display: none;" Text='<%# Eval("IsActive")%>'></asp:Label>
<asp:ImageButton ID="imgbtnStatus" runat="server" CommandArgument='<%# Eval("id") %>'
OnClick="imgbtnStatus_Onclick" />
</td>
<td class="last" align="center">
<asp:Label ID="lblCallType" runat="server" Style="display: none;" Text='<%# Eval("Calltype")%>'></asp:Label>
<asp:ImageButton ID="imgbtnEdit" runat="server" ImageUrl="~/App_Themes/ThemeNew/Images/edit.png"
ToolTip="Edit Details" CommandArgument='<%# Eval("ID") %>' OnClick="imgbtnEdit_OnClick" />
<asp:ImageButton ID="imgbtnDelete" runat="server" ImageUrl="~/App_Themes/ThemeNew/Images/delete.png"
ToolTip="Delete" Style="display: none;" CommandArgument='<%# Eval("id") %>' OnClientClick="return confirm('Are you sure you want to delete the Call type?');"
OnClick="imgbtnDelete_OnClick" />
</td>
</tr>
</ItemTemplate>
</asp:ListView>
My code behind code is:
protected void lnk_Sort(object sender, EventArgs e)
{
LinkButton lnk = (LinkButton)sender;
string arg = lnk.CommandArgument.ToString();
ViewState["sortCol"] = arg;
GetSortDirection();
BindData(ViewState["sortCol"].ToString(), ViewState["sortDir"].ToString(), Convert.ToInt32(ViewState["nmbr"]), Pager.PageSize);
string name = lnk.ID;
Image img = (Image)(lst_CallType.FindControl("img_" + name));
if (img != null)
{
SetSortOrderImage(img, ViewState["sortDir"].ToString());
}
}
private void SetSortOrderImage(Image image, String sortorder)
{
if (sortorder == "asc")
{
image.Visible = true;
image.ImageUrl = "../App_Themes/ThemeNew2/images/up.png";
}
else if (sortorder == "Desc")
{
image.Visible = true;
image.ImageUrl = "../App_Themes/ThemeNew2/images/down.png";
}
}

Categories

Resources