Category Archives: ImageButton

ImageButton

[RESOLVED]jquery open fancybox with imagebutton control

trying to use an imagebutton control to display fancybox (open a page) with parameter once clicked

seems it did not work with the following :

function RegisterFancyLinks() {
            $('iframe').fancybox({
                overlayShow: true,
                overlayColor: '#B2B2B2'
            });

        $(function () {
            var ajaxMng = Sys.WebForms.PageRequestManager.getInstance();
            ajaxMng.add_endRequest(RegisterFancyLinks);

            RegisterFancyLinks();
        });

 <asp:ImageButton ID="ibViewCustomerCredit" runat="server" ImageUrl="~/images/transmagglass.png" CssClass="iframe" />

if (cus.CustomerCode != "")
  {
       ibViewCustomerCredit.PostBackUrl = "InvoiceRatingSummary.aspx?customercode=" + strCustomerDetails[0].ToString();
  }

Hi csharp,

Thanks for your post.

ImageButton is the asp.net server side control, it will cause postback when you click it.

So if you want to execute some javascript code when the ImageButton clicked.

If so you can try below code to cancel the postback like below:

<script>
        function OpenFancy() {

            //your code to open fancybox
            //.........

        }
    </script>

<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/loading1.gif" OnClientClick="javascript:OpenFancy();return false;" />

Hope this helps, thanks.

Best Regards!

tried the following, seems like it still does not pop up the fancybox

function RegisterFancyLinks() {
            $('.iframe').fancybox({
                overlayShow: true,
                overlayColor: '#B2B2B2'
            });

 <asp:ImageButton ID="ibViewCustomerCredit" runat="server" ImageUrl="~/images/transmagglass.png"  OnClientClick="javascript:RegisterFancyLinks();return false;" />

Hi csharp_start,

First you should make sure your RegisterFancyLinks method called when click the ImageButton.

 <script>
            function RegisterFancyLinks() {
                alert('fired');

                //$('.iframe').fancybox({
                //    overlayShow: true,
                //    overlayColor: '#B2B2B2'
                //});
            }

        </script>

        <asp:ImageButton ID="ibViewCustomerCredit" runat="server" ImageUrl="~/images/transmagglass.png"  OnClientClick="javascript:RegisterFancyLinks();return false;" />

If fired, what caused your problem is the juqery plugin "fancybox"

Thanks.

Best Regards!

grid view problem

hi,

i have a first image on grid view when i click on image the second image show and first image go hide.

i want it to do on j-query.

please help me out.

thanks for the help.

Hi

Can you post the grid view mark-up (i.e. HTML) here.

<asp:GridView ID="gvBasket" runat="server" AutoGenerateColumns="False" CssClass="gvtable_normal"
                                    BorderStyle="None" CellPadding="4" ForeColor="#333333" GridLines="None">
                                    <AlternatingRowStyle BackColor="#eeeded" />
                                    <Columns>
                                        <asp:TemplateField>
                                            <ItemTemplate>
                                                <asp:ImageButton ID="imgGreenTick" CommandName="imgGreen" class="txtboxclass" ImageUrl="../images/Basket_Orbizz/tik-box.png"
                                                    runat="server" Visible="false" />
                                                <asp:ImageButton ID="imgWhiteTick" CommandName="imgWhite" ImageUrl="../images/Basket_Orbizz/nontik-box.png"
                                                    class="txtboxclass" runat="server" />
                                            </ItemTemplate>
                                            <ItemStyle CssClass="gvColumnMargin" Height="45px" />
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Credit amount">
                                            <ItemTemplate>
                                                <asp:Label runat="server" Style="font-family: Arial; font-size: 14px; font-weight: bold;
                                                    color: #707070; margin-left: 10px;" ID="lblProductName" Text='<%#Eval("Name")%>'></asp:Label>
                                                <asp:Label runat="server" Style="font-family: Arial; font-size: 14px; font-weight: bold;
                                                    color: #707070; margin-left: 25px; display: none" ID="lblProductid" Text='<%#Eval("ProductId")%>'></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle Width="160px" CssClass="ColorVersionName" HorizontalAlign="Left"></HeaderStyle>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Quantity">
                                            <ItemTemplate>
                                                <asp:TextBox ID="tbQty" Text="0" Style="font-family: Arial; font-size: 14px; font-weight: bold;
                                                    color: #707070; text-align: center; height: 10px; background-color: #fff" CssClass="buytextbox"
                                                    Columns="1" runat="server" Enabled="false" onkeypress="javascript:return onlyNumbers(this);"
                                                    onfocusout="javascript:return FetchTextbox(this);" onblur="javascript:txtQty_LostFocus(this); return FetchLabel(this);"></asp:TextBox>
                                            </ItemTemplate>
                                            <HeaderStyle CssClass="ColorVersion" Width="110px" HorizontalAlign="Left"></HeaderStyle>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Price">
                                            <ItemTemplate>
                                                <span style="font-family: arial; font-size: 14px; font-weight: bold; color: #3babfd;">
                                                    <%=Session("CSymbol")%><asp:Label Style="font-family: arial; font-size: 14px; font-weight: bold;
                                                        color: #3babfd;" ID="RetailPrice" runat="server" Text='<%#Eval("Price","{0:F2}") %>'></asp:Label></span>
                                                <asp:HiddenField ID="hdnPrice" Value='<%#Eval("Price") %>' runat="server" />
                                            </ItemTemplate>
                                            <HeaderStyle CssClass="ColorVersion" Width="110px" HorizontalAlign="Left"></HeaderStyle>
                                        </asp:TemplateField>
                                        <asp:TemplateField ItemStyle-BackColor="#ffffff">
                                            <ItemTemplate>
                                                <asp:Label ID="TotalPRice" runat="server"></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Left" CssClass="ColorVersion"></HeaderStyle>
                                        </asp:TemplateField>
                                        <asp:TemplateField ItemStyle-BackColor="#ffffff">
                                            <ItemTemplate>
                                                <asp:Image ID="Image1" Style="margin-bottom: -11px;" ImageUrl="../images/DataUSBDongle/Scroll-Save10.png"
                                                    runat="server" Visible="false" />
                                                <asp:Image ID="Image2" ImageUrl="../images/DataUSBDongle/Scroll-Save20.png" runat="server"
                                                    Style="margin-bottom: -11px;" Visible="false" />
                                                <asp:Image ID="DSave15" runat="server" src="../images/BasketSIMCard/Scroll-$-Save15.png"
                                                    Visible="false" Style="margin-bottom: -11px;" />
                                                <asp:Image ID="DSave30" runat="server" src="../images/BasketSIMCard/Scroll-$-Save30.png"
                                                    Visible="false" Style="margin-bottom: -11px;" />
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Left" CssClass="ColorVersion"></HeaderStyle>
                                        </asp:TemplateField>
                                    </Columns>
                                    <EditRowStyle BackColor="#999999" />
                                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle ForeColor="Gray" />
                                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Left" />
                                    <RowStyle ForeColor="#333333" Font-Size="small" />
                                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                    <SortedAscendingCellStyle BackColor="#E9E7E2" />
                                    <SortedAscendingHeaderStyle BackColor="#506C8C" />
                                    <SortedDescendingCellStyle BackColor="#FFFDF8" />
                                    <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                                </asp:GridView>

Hi

From your mark-up Ii see there are more images controls, for which images you wanted to have the jquery show/hide functionality. If you hide the first image and show the second image, how do you undo that(i.e. showing the first image again and hide the second
image).

and you are hiding the image controls using (Visible=false) with setting this property to
false server will not render the controls and java script/jquery will not get those controls which are not there in the mark-up.

Try set the style=’display:none’

Hope you understand. 

Hi immad,

For there are many images controls, I am not quite sure which you wanted to have show/hide functionality.

Please explain more exactly about which image control you want to click and hide.

Best Regards,

Kevin Shen.

[RESOLVED]How do I remove an item from a listview with Jquery?

I want to remove an item from a ListView with Jquery.  How do I do that?

Could you provide an example of what your ListView might look like? Or an example of what your rendered markup (within your page) might look like?

Once you get a feel for how to use jQuery selectors to target specific elements, it can make their removal quite easy. It would be much easier to have some existing data to work with, but if you don’t, I could throw together a quick example.

Actually, I’ll just throw together one real quick.

Let’s say you have a ListView that looks like the following :

<form id="form1" runat="server">
        <!-- Your List View -->
        <asp:ListView ID="YourListView" runat="server">
            <ItemTemplate>
                <div id="element-<%# Eval("Value") %>">
                    <%# Eval("Value") %>
                </div>
            </ItemTemplate>
        </asp:ListView>
</form>

This is fairly simple as you can tell. It simply generate a <div> element for each value in your collection and gives an id to that element of "element-x", where x is the value. You could use the following code to handle this mapping (for example purposes)
:

public partial class Example : System.Web.UI.Page
{
        protected void Page_Load(object sender, EventArgs e)
        {
            // Bind 25 integers to the List
            YourListView.DataSource = Enumerable.Range(1, 25).Select(w => new Widget(w));
            YourListView.DataBind();
        }
}

// An example class to demonstrate data binding
public class Widget
{
        public int Value { get; set; }

        public Widget(int value)
        {
            Value = value;
        }
}

This will generate something that looks like this :

Each of these elements will have markup that looks like this :

<div id="element-1">
    1
</div>

Using this, you can easily use jQuery to select a particular element based on it’s name by just prefacing the item with ‘element-’. So if you wanted to remove the 5th element, you would use :

<!-- Example jQuery Reference -->
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
<script type="text/javascript">
        $(function() {
            // When the page loads, remove the fifth element
            $("#element-5").remove();
        });
</script>

This is a very basic example, however you could easily alter it to target elements by other properties or their actual indices themselves. It ultimately just depends on how your ListView is structured at present.

I always appreciate your help Rion!

Here is an example. I didn’t provide all of the html, but here is where the delete control is.

 <ItemTemplate>                
                    <tr class="even">
                        <td style="width: 50px; white-space: nowrap">
                            <asp:ImageButton ID="btnDelete" runat="server" ImageUrl="~//images/icons/Delete.png" CssClass="lvBtnDelete"  CommandName="Delete" ToolTip="Click to Delete this Item" OnClientClick="listViewDelete('ListViewContacts');"/>
                            <asp:ImageButton ID="btnSelect" runat="server" ImageUrl="~//images/icons/Select.png" CssClass="lvBtnSelect" CommandName="Select" ToolTip="Click to Make this choice a Contact for this Loan"/>
                        </td>

when I click on btnDelete, I want to delete the item in the displayed listview. The way it works now, I have to do a postback and run c# codebehind to do it.  I would like to avoid that.

Do you actually want to delete the item from the datasource that is populating your ListView or just remove it from the actual page (without having a postback)?

I was going to let the codebehind delete it as it does when a PostBack is done. But just have it out of the ListView Immediately when it is deleted.

jquery open fancybox with imagebutton control

trying to use an imagebutton control to display fancybox (open a page) with parameter once clicked

seems it did not work with the following :

function RegisterFancyLinks() {
            $('iframe').fancybox({
                overlayShow: true,
                overlayColor: '#B2B2B2'
            });

        $(function () {
            var ajaxMng = Sys.WebForms.PageRequestManager.getInstance();
            ajaxMng.add_endRequest(RegisterFancyLinks);

            RegisterFancyLinks();
        });

 <asp:ImageButton ID="ibViewCustomerCredit" runat="server" ImageUrl="~/images/transmagglass.png" CssClass="iframe" />

if (cus.CustomerCode != "")
  {
       ibViewCustomerCredit.PostBackUrl = "InvoiceRatingSummary.aspx?customercode=" + strCustomerDetails[0].ToString();
  }

Hi csharp,

Thanks for your post.

ImageButton is the asp.net server side control, it will cause postback when you click it.

So if you want to execute some javascript code when the ImageButton clicked.

If so you can try below code to cancel the postback like below:

<script>
        function OpenFancy() {

            //your code to open fancybox
            //.........

        }
    </script>

<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/loading1.gif" OnClientClick="javascript:OpenFancy();return false;" />

Hope this helps, thanks.

Best Regards!

[RESOLVED]HoverMenuExtender on page using ModalPopupExtender PostBackIssue

I have a page that has a simple hovermenu extending a panel with a radiobuttonlist on it (just used to toggle a setting).  The problem is that the page also implements a modalpopup that displays the results of a search.  If I click on an item in the popup,
everything works fine (popup closes, code runs, page posts back).  The problem is, after the postback caused by the popup, the hovermenu panel becomes stuck visible.

Code is below:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="DirectorySpyWebEdition._default" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <title>DirectorySpy: Web Edition</title>
    <link href="Style.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
        <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>
        <div id="header">
            <h2>DirectorySpy
            </h2>
        </div>
        <div id="search">
            <asp:Label ID="lblSearch" runat="server" Text="Search:" CssClass="lblSearch"></asp:Label>
            <asp:TextBox ID="txtSearch" runat="server" CssClass="txtSearch" BorderStyle="Solid" Font-Bold="True" Font-Size="X-Large"></asp:TextBox>
            <asp:ImageButton ID="imgBtnSearch" runat="server" ImageUrl="~/Images/Search-icon3.png" CssClass="imgBtn" OnClick="imgBtnSearch_Click" />
        </div>
        <div id="domainSelector">
            <asp:Button ID="btnDomain" runat="server" CssClass="btnDomain" Text="Domain ▲" />
            <asp:UpdatePanel ID="updPanelDomain" runat="server" UpdateMode="Always">
                <ContentTemplate>
                    <asp:Panel ID="pnlDomain" runat="server">
                        <asp:RadioButtonList ID="rbListDomain" runat="server" CssClass="rbListDomain" >
                            <asp:ListItem Selected="True">Domain1.COM</asp:ListItem>
                            <asp:ListItem>Domain2.COM</asp:ListItem>
                        </asp:RadioButtonList>
                    </asp:Panel>
                </ContentTemplate>
            </asp:UpdatePanel>
            <br />
            <asp:HoverMenuExtender ID="HoverMenuExtender1" runat="server" PopDelay="30" PopupControlID="pnlDomain" PopupPosition="Bottom" TargetControlID="btnDomain"></asp:HoverMenuExtender>
        </div>
        <div id="content">
            <table align="center">
                <tr>
                    <td>
                        <asp:UpdatePanel ID="updPanelGeneralTab" runat="server" UpdateMode="Always" Visible="true">
                            <ContentTemplate>
                                <asp:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" Width="100%">
                                    <asp:TabPanel ID="tabGeneral" runat="server" HeaderText="General">
                                        <ContentTemplate>
                                            <table class="tabTable">
                                                <tr>
                                                    <td>
                                                        <asp:GridView ID="gvGeneralTab" runat="server" CssClass="grid" AutoGenerateColumns="False" ShowHeader="False">
                                                            <Columns>
                                                                <asp:BoundField DataField="attribute">
                                                                    <ItemStyle Width="150px" Font-Bold="True" />
                                                                </asp:BoundField>
                                                                <asp:TemplateField HeaderText="value">
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="Label22" runat="server" Text='<%# Bind("value") %>'></asp:Label>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                            </Columns>
                                                        </asp:GridView>
                                                    </td>
                                                </tr>
                                            </table>
                                        </ContentTemplate>
                                    </asp:TabPanel>
                                    <asp:TabPanel ID="tabAddress" runat="server" HeaderText="Address">
                                        <ContentTemplate>
                                            <table class="tabTable">
                                                <tr>
                                                    <td>
                                                        <asp:GridView ID="gvAddressTab" runat="server" CssClass="grid" AutoGenerateColumns="False" ShowHeader="False">
                                                            <Columns>
                                                                <asp:BoundField DataField="attribute">
                                                                    <ItemStyle Width="150px" Font-Bold="true" />
                                                                </asp:BoundField>
                                                                <asp:TemplateField HeaderText="value">
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="Label23" runat="server" Text='<%# Bind("value") %>'></asp:Label>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                            </Columns>
                                                        </asp:GridView>
                                                    </td>
                                                </tr>
                                            </table>
                                        </ContentTemplate>
                                    </asp:TabPanel>
                                    <asp:TabPanel ID="tabObjectInfo" runat="server" HeaderText="Object Info">
                                        <ContentTemplate>
                                            <table class="tabTable">
                                                <tr>
                                                    <td>
                                                        <asp:GridView ID="gvObjectInfoTab" runat="server" CssClass="grid" AutoGenerateColumns="False" ShowHeader="False">
                                                            <Columns>
                                                                <asp:BoundField DataField="attribute">
                                                                    <ItemStyle Width="150px" Font-Bold="true" />
                                                                </asp:BoundField>
                                                                <asp:TemplateField HeaderText="value">
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="Label24" runat="server" Text='<%# Bind("value") %>'></asp:Label>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                            </Columns>
                                                        </asp:GridView>
                                                    </td>
                                                </tr>
                                            </table>
                                        </ContentTemplate>
                                    </asp:TabPanel>
                                    <asp:TabPanel ID="tabExchange" runat="server" HeaderText="Exchange">
                                        <ContentTemplate>
                                            <table class="tabTable">
                                                <tr>
                                                    <td>
                                                        <asp:GridView ID="gvExchangeTab" runat="server" CssClass="grid" AutoGenerateColumns="False" ShowHeader="False">
                                                            <Columns>
                                                                <asp:BoundField DataField="attribute">
                                                                    <ItemStyle Width="150px" Font-Bold="true" />
                                                                </asp:BoundField>
                                                                <asp:TemplateField HeaderText="value">
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="Label24" runat="server" Text='<%# Bind("value") %>'></asp:Label>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                            </Columns>
                                                        </asp:GridView>
                                                    </td>
                                                </tr>
                                            </table>
                                        </ContentTemplate>
                                    </asp:TabPanel>
                                    <asp:TabPanel ID="tabProxyAddresses" runat="server" HeaderText="Proxy Addresses">
                                        <ContentTemplate>
                                            <table class="tabTable">
                                                <tr>
                                                    <td>
                                                        <asp:GridView ID="gvProxyAddressesTab" runat="server" AutoGenerateColumns="False" CssClass="grid" ShowHeader="False">
                                                            <Columns>
                                                                <asp:BoundField DataField="proxyAddress" />
                                                            </Columns>
                                                        </asp:GridView>
                                                    </td>
                                                </tr>
                                            </table>
                                        </ContentTemplate>
                                    </asp:TabPanel>
                                    <asp:TabPanel ID="tabRestrictions" runat="server" HeaderText="Restrictions">
                                        <ContentTemplate>
                                            <table class="tabTable">
                                                <tr>
                                                    <td>
                                                        <asp:GridView ID="gvRestrictionsTab" runat="server" AutoGenerateColumns="False" CssClass="grid" ShowHeader="False">
                                                            <Columns>
                                                                <asp:BoundField DataField="authOrig" />
                                                            </Columns>
                                                        </asp:GridView>
                                                    </td>
                                                </tr>
                                            </table>
                                        </ContentTemplate>
                                    </asp:TabPanel>
                                    <asp:TabPanel ID="tabMembers" runat="server" HeaderText="Members">
                                        <ContentTemplate>
                                            <table class="tabTable">
                                                <tr>
                                                    <td>
                                                        <asp:GridView ID="gvMembersTab" runat="server" AutoGenerateColumns="False" CssClass="grid" ShowHeader="False">
                                                            <Columns>
                                                                <asp:BoundField DataField="member" />
                                                            </Columns>
                                                        </asp:GridView>
                                                    </td>
                                                </tr>
                                            </table>
                                        </ContentTemplate>
                                    </asp:TabPanel>
                                    <asp:TabPanel ID="tabMemberOf" runat="server" HeaderText="Member Of">
                                        <ContentTemplate>
                                            <table class="tabTable">
                                                <tr>
                                                    <td>
                                                        <asp:GridView ID="gvMemberOfTab" runat="server" AutoGenerateColumns="False" CssClass="grid" ShowHeader="False">
                                                            <Columns>
                                                                <asp:BoundField DataField="memberOf" />
                                                            </Columns>
                                                        </asp:GridView>
                                                    </td>
                                                </tr>
                                            </table>
                                        </ContentTemplate>
                                    </asp:TabPanel>
                                    <asp:TabPanel ID="tabManagerOf" runat="server" HeaderText="Manager Of">
                                        <ContentTemplate>
                                            <table class="tabTable">
                                                <tr>
                                                    <td>
                                                        <asp:GridView ID="gvManagerOfTab" runat="server" AutoGenerateColumns="False" CssClass="grid" ShowHeader="False">
                                                            <Columns>
                                                                <asp:BoundField DataField="managedObjects" />
                                                            </Columns>
                                                        </asp:GridView>
                                                    </td>
                                                </tr>
                                            </table>
                                        </ContentTemplate>
                                    </asp:TabPanel>
                                    <asp:TabPanel ID="tabPhoto" runat="server" HeaderText="Photo">
                                        <ContentTemplate>
                                            <table class="tabTable">
                                                <tr>
                                                    <td align="center">
                                                        <asp:Image ID="thumbnailPhoto" runat="server" ImageUrl="~/Images/sil_med.png" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </ContentTemplate>
                                    </asp:TabPanel>
                                </asp:TabContainer>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </td>
                </tr>
            </table>
        </div>
        <div id="footer">
        </div>
        <!-- Search Popup -->
        <asp:Button ID="popupSearchTargetControl" runat="server" Style="display: none" />
        <asp:ModalPopupExtender ID="popupSearch" runat="server" BackgroundCssClass="modalBackground" TargetControlID="popupSearchTargetControl" PopupControlID="pnlPopupSearch" BehaviorID="bPopupSearch"></asp:ModalPopupExtender>
        <asp:Panel ID="pnlPopupSearch" runat="server" CssClass="popupSearch">
            <asp:UpdatePanel ID="updPanelPopupSearch" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <table id="tblPopupSearchHeader" align="center" cellpadding="0" cellspacing="0" width="100%">
                        <tr>
                            <td style="border-bottom: solid; border-width: 3px; background-color: #c8332e; color: white; font-family: 'Cordia New'; border-bottom-color: black;" align="left">
                                <div style="padding-left: 10px; font: bold; font-size: large;">
                                    Search Results:<asp:Label ID="lblPopupSearchHeader" runat="server"></asp:Label>
                                </div>
                            </td>
                            <td align="right" style="background-color: #c8332e; color: white; border-bottom: solid; border-bottom-color: black; border-width: 3px; vertical-align: bottom;">
                                <asp:Button ID="Button2" runat="server" BackColor="Black" BorderStyle="None" ForeColor="White" Height="25px" OnClientClick="$find('bPopupSearch').hide(); return false;" Text="X" Width="25px" />
                            </td>
                        </tr>
                    </table>
                    <table width="100%">
                        <tr>
                            <td>
                                <asp:GridView ID="gvSearchResults" runat="server" AutoGenerateColumns="False" Font-Names="Cordia New" AllowPaging="True" Width="100%" OnPageIndexChanging="gvSearchResults_PageIndexChanging" CssClass="searchResultsGrid" OnRowCommand="gvSearchResults_RowCommand">

                                    <Columns>
                                        <asp:TemplateField HeaderText="cn">
                                            <ItemTemplate>
                                                <asp:LinkButton ID="LinkButton1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "cn") %>' CommandArgument='<%# DataBinder.Eval(Container.DataItem, "adsPath") %>' CommandName="loadObject"></asp:LinkButton>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="objectClass">
                                            <ItemTemplate>
                                                <asp:Label ID="Label18" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "objectClass") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="sAMAccountName">
                                            <ItemTemplate>
                                                <asp:Label ID="Label19" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "sAMAccountName") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="physicalDeliveryOfficeName">
                                            <ItemTemplate>
                                                <asp:Label ID="Label20" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "physicalDeliveryOfficeName") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="adsPath" Visible="False">
                                            <ItemTemplate>
                                                <asp:Label ID="Label21" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "adsPath") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                    <PagerSettings Mode="NumericFirstLast" />
                                </asp:GridView>
                            </td>
                        </tr>
                    </table>
                </ContentTemplate>
            </asp:UpdatePanel>
        </asp:Panel>
        <!-- Empty Search Results Panel-->
        <asp:Button ID="popupNoSearchResultsTargetControl" runat="server" Style="display: none" />
        <asp:ModalPopupExtender ID="popupNoSearchResults" runat="server" BackgroundCssClass="modalBackground" TargetControlID="popupNoSearchResultsTargetControl" PopupControlID="pnlPopupNoSearchResults" BehaviorID="bPopupNoSearchResults"></asp:ModalPopupExtender>
        <asp:Panel ID="pnlPopupNoSearchResults" runat="server" CssClass="popupNoSearchResults">
            <asp:UpdatePanel ID="updPanelPopupNoSearchResults" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <table id="tblPopupNoSearchResultsHeader" align="center" cellpadding="0" cellspacing="0" width="100%">
                        <tr>
                            <td style="border-bottom: solid; border-width: 3px; background-color: #c8332e; color: white; font-family: 'Cordia New'; border-bottom-color: black;" align="left">
                                <div style="padding-left: 10px; font: bold; font-size: large;">
                                    Search Results:<asp:Label ID="lblPopupNoSearchResultsHeader" runat="server"></asp:Label>
                                </div>
                            </td>
                            <td align="right" style="background-color: #c8332e; color: white; border-bottom: solid; border-bottom-color: black; border-width: 3px; vertical-align: bottom;">
                                <asp:Button ID="Button1" runat="server" BackColor="Black" BorderStyle="None" ForeColor="White" Height="25px" OnClientClick="$find('bPopupNoSearchResults').hide(); return false;" Text="X" Width="25px" />
                            </td>
                        </tr>
                    </table>
                    <table width="100%">
                        <tr>
                            <td>

                            </td>
                        </tr>
                        <tr>
                            <td align="center" style="font-family:'Cordia New';">
                                <asp:Label ID="Label1" runat="server" Text="No objects found..." Font-Size="X-Large"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td>

                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                                <asp:Button ID="btnCloseNoResultsPopup" runat="server" CssClass="btn" Text="Close" OnClick="btnCloseNoResultsPopup_Click" />
                            </td>
                        </tr>
                    </table>
                </ContentTemplate>
            </asp:UpdatePanel>
        </asp:Panel>

    </form>
</body>
</html>

Well… I had an idea… after a day of scratching my head (should have noticed earlier).  I resolved the issue by wrapping the page in an updatepanel (everything between the form tags).

Auto complete not working ???

.aspx page

<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="ImageButton1"
                                                                PopupControlID="panelproduct" RepositionMode="RepositionOnWindowResizeAndScroll"
                                                                PopupDragHandleControlID="panelproduct">
                                                            </cc1:ModalPopupExtender>
                                                            <asp:Panel ID="panelproduct" runat="server" Width="350" BorderColor="black" BackColor="#9A9A9A">
                                                                <table style="width: 100%; border: 1px solid #000;">
                                                                    <tr>
                                                                        <td align="right" class="style4" width="30%">
                                                                            Product Name:
                                                                        </td>
                                                                        <td>
                                                                            <asp:TextBox ID="txtaddproduct" runat="server"  autocomplete="off"></asp:TextBox>
                                                                            <cc1:AutoCompleteExtender ID="txtaddproduct_AutoCompleteExtender"
                                                                                runat="server" EnableCaching="true"
                                                        DelimiterCharacters="" Enabled="True" ServiceMethod="GetCompletionList" ServicePath=""
                                                        TargetControlID="txtaddproduct" UseContextKey="True" MinimumPrefixLength="1" ShowOnlyCurrentWordInCompletionListItem="true">
                                                                            </cc1:AutoCompleteExtender>
                                                                           <%-- <cc1:AutoCompleteExtender ID="txtaddproduct_AutoCompleteExtender" runat="server"
                                                                                EnableCaching="true" DelimiterCharacters="" Enabled="True" ServiceMethod="GetCompletionList"
                                                                                ServicePath="WebService.asmx" TargetControlID="txtaddproduct" UseContextKey="True"
                                                                                MinimumPrefixLength="1" ShowOnlyCurrentWordInCompletionListItem="true">
                                                                            </cc1:AutoCompleteExtender>--%>
                                                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" ControlToValidate="txtaddproduct"
                                                                                ErrorMessage="*" ValidationGroup="qq"></asp:RequiredFieldValidator>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td align="right" class="style4" width="30%">
                                                                            Brand Name:
                                                                        </td>
                                                                        <td>
                                                                            <asp:TextBox ID="txtaddbrand" runat="server"></asp:TextBox>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td align="right" class="style4" width="30%">
                                                                            Opening Stock:
                                                                        </td>
                                                                        <td>
                                                                            <asp:TextBox ID="txtaddopeningstock" runat="server"></asp:TextBox>
                                                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtaddopeningstock"
                                                                                ErrorMessage="*" ValidationGroup="qq"></asp:RequiredFieldValidator>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td align="right" class="style4" width="30%">
                                                                            Unit:
                                                                        </td>
                                                                        <td>
                                                                            <asp:TextBox ID="txtaddunit" runat="server"></asp:TextBox>
                                                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ControlToValidate="txtaddunit"
                                                                                ErrorMessage="*" ValidationGroup="qq"></asp:RequiredFieldValidator>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td align="right" class="style4" width="30%">
                                                                        </td>
                                                                        <td>
                                                                            <asp:Button ID="Button4" runat="server" Text="Add" CssClass="button_bg" OnClick="Button4_Click2"
                                                                                ValidationGroup="qq" />
                                                                            <asp:Button ID="Button5" runat="server" Text="Cancel" CssClass="button_bg" OnClick="Button5_Click1" />
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </asp:Panel>

.cs

  [System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
    public static string[] GetCompletionList(string prefixText, int count, string contextKey)
    {
        DataSet ds = new DataSet();
        clsGENERAL obj = new clsGENERAL();
        string slc = "select Product from master_item where Product like '" + prefixText + "%'";
        ds = obj.SelectQuery1(slc);
        string[] items = new string[ds.Tables[0].Rows.Count];
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            items.SetValue(ds.Tables[0].Rows[i]["Product"].ToString(), i);
        }
        return items;

    }

Have you enabled pagemethods on the ScriptManager?

Hi,

Please refer to the example at:
http://forums.asp.net/p/1582937/3996380.aspx#3996380
. Any more question, please feel free to reply.

In my other page its work finnaly with modalpopupextender but in this page i got problem

[RESOLVED]How to get data from GridView by using radiobutton ?

img1

Hi , everyone Smile

I want to get row id  when clicked radio button.  

I can get data by using Commandfield "Select" (Column Seçim).  But i dont use coloumn "Seçim" to get data in gridview .  just want to choose radio button to get row id …

Here is my code . Please advice me . Thanks a lotWink  (Some coloumn names or datas can be Turkish word. Dont care about
that )

<asp:GridView ID="gridViewIsemri" runat="server"  AutoGenerateColumns="False"
            BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px"
            CellPadding="3" CellSpacing="1" DataSourceID="SqlDataSource1"
            GridLines="None"
            
            OnRowCommand="Grid_RowCommand">

            <Columns>
                <asp:BoundField DataField="IsEmriNo" HeaderText="IsEmriNo"
                    InsertVisible="False" ReadOnly="True" SortExpression="IsEmriNo" />
                <asp:BoundField DataField="IsEmriTipi" HeaderText="IsEmriTipi"
                    SortExpression="IsEmriTipi" />
                <asp:BoundField DataField="IsEmriBasTarihi" HeaderText="IsEmriBasTarihi"
                    SortExpression="IsEmriBasTarihi" />
                <asp:BoundField DataField="IsEmriBitTarihi" HeaderText="IsEmriBitTarihi"
                    SortExpression="IsEmriBitTarihi" />
                <asp:BoundField DataField="IsEmriAciklama" HeaderText="IsEmriAciklama"
                    SortExpression="IsEmriAciklama" />
               
                
                <asp:CommandField HeaderText="Seçim" ShowSelectButton="True"  />
                <asp:TemplateField>
                        <ItemTemplate>
                            <asp:RadioButton ID="rdButton" runat="server" Text="Seçiniz..." >
                            </asp:RadioButton>
                        </ItemTemplate>
                    </asp:TemplateField>
            </Columns>
            
            <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
            <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
            <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
            <RowStyle BackColor="#DEDFDE" ForeColor="Black" />
            <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#594B9C" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#33276A" />
        </asp:GridView>

        protected void Grid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
           if (e.CommandName == "Select")
            {
                Int32 num = Convert.ToInt32(e.CommandArgument);
                txtboxisEmriNo.Text = gridViewIsemri.Rows[num].Cells[0].Text;
                drpdownTip.Text = gridViewIsemri.Rows[num].Cells[1].Text;
                txtboxAcik.Text = gridViewIsemri.Rows[num].Cells[4].Text;
            }

         }

 

<asp:TemplateField>
                        <ItemTemplate>
                            <asp:RadioButton ID="rdButton" runat="server" Text="Seçiniz…"  CommandArgument=’<%# ((GridViewRow)Container).RowIndex %>’ >
                            </asp:RadioButton>
                        </ItemTemplate>
                    </asp:TemplateField>

By Using this code, U can get Row id  or Rowindex in RowCommand Event.

or else

you can use your any other datavalue bu using bind. ( Bind(‘<%# Bind(" ur id filed.")%>’))

hi,

RadioButton can’t trigger rowcommand event ,and I think fetch a data by click radiobutton is not Reasonable .

I think use a checkbox column is best way .

refer the below link :

http://www.asp.net/web-forms/tutorials/data-access/enhancing-the-gridview/adding-a-gridview-column-of-checkboxes-cs

Hope this helps

 

Try like this

Add Item Template with radio button

  <asp:TemplateField>
      <ItemTemplate>
         <asp:RadioButton ID="rdbtnSelect" AutoPostBack="true" CausesValidation="false" OnCheckedChanged="rdbtnSelect_CheckedChanged"         runat="server" />
                                                                  
        </ItemTemplate>
 </asp:TemplateField>

Write the Function in .cs file like bellow

  protected void rdbtnSelect_CheckedChanged(object sender, EventArgs e)
    {
     
        RadioButton btn = (RadioButton)sender;

// get the selectd row like bellow
        GridViewRow row = (GridViewRow)btn.NamingContainer;

}

try to pass command arguments to your radio button and then read those form code behid file,

use gridview row command event inside that use findcontrol method

Hi Try This…

Add  AutoPostBack="true"
and
OnCheckedChanged="rdbtnSelect_CheckedChanged" in
RadioButton…

<asp:TemplateField>
                        <ItemTemplate>
                            <asp:RadioButton ID="rdButton" CausesValidation="false"  runat="server" Text="Seçiniz..." OnCheckedChanged="rdbtnSelect_CheckedChanged"
                                AutoPostBack="true" GroupName="FakeGroup" ></asp:RadioButton>
                        </ItemTemplate>
                    </asp:TemplateField>
    protected void rdbtnSelect_CheckedChanged(object sender, EventArgs e)
    {
        int Index = 0;
        for (int i = 0; i < gridViewIsemri.Rows.Count; i++)
        {
            RadioButton rb = default(RadioButton);
            rb = (RadioButton)gridViewIsemri.Rows[i].FindControl("rdButton");
            if (rb.Checked == true)
            {
                Response.Write("Your Selected index=" + Index.ToString());
            }
            Index = Index + 1;
        }

   }



Thank you very much Smile

<asp:ImageButton ID="ImageButton1" runat="server" Height="30px"
                             ImageUrl="~/button_plus_blue.ico" Width="30px" CommandName="ibutonsec"  CommandArgument='<%# ((GridViewRow)Container).RowIndex %>' />
                        </ItemTemplate>

I fixed this code block .  Thank you very much every one Laughing

[RESOLVED]imagebutton commandname in listview not respond

<asp:UpdatePanel ID="UpdatePanel3" runat="server">
            <ContentTemplate>

        <div class="slip-background">
            <asp:ListView ID="ListView1"  runat="server" DataKeyNames="Stake, StakeSum" OnItemDataBound="ListView1Slip_ItemDataBound"  OnItemCommand="ListView1_ItemCommand" >
                <ItemTemplate>
                    <div class="slipbet-data">
                        <div style="float:left; margin-left:-4px; margin-top:2px;"><asp:Image ID="Image1" runat="server" ImageUrl="~/images/datetime-icon.png" ImageAlign="AbsBottom" ToolTip='<%# Eval("DateOfEvent") %>'  /></div><div style="margin-left:15px;"><asp:Label ID="lblNameOfEventLabel" runat="server" Text='<%# Eval("NameOfEvent") %>'></asp:Label></div>
                        <asp:ImageButton ID="ImageButton1" CommandName="DeleteEvent" AlternateText="2" runat="server" />
                        <div style="margin-left:15px;"><asp:Label ID="lblTypeOfBets" runat="server" Text='<%# Eval("TypeOfBets") %>'></asp:Label></div>
                        <div style="float:left; margin-left:15px;"><asp:Label ID="lblPickLabel" runat="server" Font-Bold="true" Text="Pick:"> </asp:Label> <asp:Label ID="lblPick" runat="server" Font-Bold="true" Text='<%# Eval("Pick") %>'></asp:Label></div>
                        <div style="float:right"><asp:Label ID="lblOddsLabel" runat="server" Text='<%# Eval("Odds") %>'></asp:Label></div><br />
                        <div id="DivStake" runat="server">
                        <div style="float:left;margin-left:15px; margin-top:2px;">Stake <asp:TextBox ID="txtStake" Text='<%# (Convert.ToString(Eval("Stake"))) == "" ? "0.00" : Eval("Stake") %>'  runat="server" class="staketext" Height="12px" Width="50px" ></asp:TextBox></div>
                        <div style="float:right;"><asp:Label ID="lblStake" class="stake" Text='<%# (Convert.ToString(Eval("StakeSum"))) == "" ? "0.00" : Eval("StakeSum") %>'  runat="server" ></asp:Label></div><br /></div>
                    </div>
                </ItemTemplate>
                <EmptyDataTemplate>No bet has been selected. To select a new bet, please click on the respective odds.</EmptyDataTemplate>

            </asp:ListView>
        </div>
    protected void ListView1_ItemCommand(object source, ListViewCommandEventArgs e)
    {
        if (e.CommandName == "DeleteEvent")
        {
         /*   ListViewItem item = ((Control)e.CommandSource).NamingContainer as ListViewItem;

            string EventDelete = ListView1.DataKeys[item.DataItemIndex].ToString();

            Session["DelId"] = EventDelete;

       

            Response.Redirect(Request.Url.ToString());*/

            Response.Redirect("22");


        }

What is problem with my example?

Hi,

Maybe you have to refill the ListView on each PostBack.

Here are some similar threads, please try to refer to:

http://stackoverflow.com/questions/11992450/asp-net-editing-item-from-listview-using-an-imagebutton .

http://stackoverflow.com/questions/5329002/imagebutton-within-listview-problem .

Hope it helps.

Best Regards,
Amy Peng

[RESOLVED]No overload for 'ListView1_ItemCommand'

<asp:ListView ID="ListView1"  runat="server" DataKeyNames="Stake, StakeSum" OnItemDataBound="ListView1Slip_ItemDataBound" OnItemCommand="ListView1_ItemCommand" >

returns No overload for ‘ListView1_ItemCommand’ .

I need to use Command events because I have                    <asp:ImageButton ID="ImageButton1" CommandName="DeleteEvent" runat="server" /> and I want to call DeleteEvent function.

Please help.

Hi,

You have post a same question in:

http://forums.asp.net/t/1922224.aspx .

Please try to check it.

Best Regards,
Amy Peng