我无法在jquery对话框中使用asp控件 [英] I am unable to use the asp control on jquery dialog

查看:56
本文介绍了我无法在jquery对话框中使用asp控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

   I am using Jquery dialog. So i  click on Edit button it shows me dialog but when i click on Update button then its click event does not occur .

but if i use  <pre>$("#dialog_form").parent().appendTo($("#form:first"));

那么两者都是对话框和页面都是残缺的。









then both the dialog as well as page diabled.




$(document).ready(function () {

            var myDialog = $("#dialog_form").dialog({
                autoOpen: false,
                height: 500,
                width: 450,
                 modal: true,
//                open: function (event, ui) {
//                    $(this).parent().appendTo("#divDlgContainer");
//                },
                close: function () {

                }
            });



        });

        function showDialog() {

            $(function () {
                var myDialog = $("#dialog_form").dialog("open");
               // $("#dialog_form").parent().appendTo($("#form:first"));

            });
            return false;

        }
       
        function showUpdateMessage() {
            $(function () { $("#dialog_form").dialog("close"); });
            $('#Message').html("Record is Updated");
        }













using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using Model;
using System.Text;
using System.IO;

namespace Inventory_Management_System.Vendor
{
    public partial class Brands : System.Web.UI.Page
    {
        BuisnessLayer _objBuisnessLayer = new BuisnessLayer();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Databind();
            }

        }
        public void Databind()
        {
           
            dataListBrand.DataSource = _objBuisnessLayer.GetAllBrands();
            dataListBrand.DataBind();
        
        }
        protected void EditBrands(object sender, DataListCommandEventArgs e)
        {
           
             StringBuilder str=new StringBuilder();
            str.Append("showDialog()");
           Brand brand= _objBuisnessLayer.GetBrandById(Convert.ToInt32(e.CommandArgument.ToString()));
           OldImageBrand.ImageUrl = brand.Logo;
           txtBrandName.Text = brand.BrandName;
           txtHeadQuarter.Text = brand.Headquaters;
           txtBrandId.Text = brand.BrandCode.ToString();
            ScriptManager.RegisterClientScriptBlock(this,this.GetType(),"Key",str.ToString(),true);

        }
        protected void btnUpdate_Click(object sender, EventArgs e)
        {

            Brand brand = new Brand();
            brand.BrandCode = Convert.ToInt32(txtBrandId.Text);
            brand.BrandName = txtBrandName.Text;
            brand.Headquaters = txtHeadQuarter.Text;
            String path=Server.MapPath("~/Images/Brands/" + brand.BrandName + "/Logo.gif");
            if (fileUploadImage.HasFile)
            {
               
                fileUploadImage.SaveAs(path);
            }
            brand.Logo = path;
            if (_objBuisnessLayer.UpdateBrand(brand) > 0)
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Key", "showUpdateMessage()", true);
            else
                lblErrorMessage.Text = "error in updating records";



        
        }
    }
}













<asp:Content ID="ContentBody" ContentPlaceHolderID="ContentPlaceHolderBody" runat="server">
    <div id="datalist">
        <asp:DataList ID="dataListBrand" runat="server" RepeatColumns="5" RepeatDirection="Horizontal"

            OnEditCommand="EditBrands">
            <ItemTemplate>
                <div class="items">
                    <div class="image">
                        <asp:Image ID="ImageLogo" ImageUrl='<%#Eval("Logo") %> ' AlternateText="Image" Width="160px"

                            Height="100px" runat="server" />
                    </div>
                    <asp:Label ID="lblBrandName" runat="server" Text='<%# Eval("BrandName") %>'></asp:Label></h1>
                    <asp:LinkButton runat="server" Text="Edit" CommandName="Edit" CommandArgument='<%# Eval("BrandCode") %>' />
                </div>
            </ItemTemplate>
            <EditItemTemplate>
            </EditItemTemplate>
            <AlternatingItemStyle BackColor="#F0F0F0" />
        </asp:DataList>
        <div id="Message">
        </div>
    </div>
    <div id="divDlgContainer">
    <div id="dialog_form" title="Update Or Cancel">
        <asp:Panel ID="PanelUpdate" runat="server">
            <asp:Image runat="server" ID="OldImageBrand" Height="100px" Width="350px" />
            <fieldset>
                <legend>Update</legend>
                <table>
                    <tr>
                        <td>
                            <asp:Label ID="lblBrandId" Text="Brand Id" runat="server" />
                        </td>
                        <td>
                            <asp:TextBox ID="txtBrandId" runat="server" ReadOnly="true" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="lblNewBrandName" Text="Brand Name" runat="server" />
                        </td>
                        <td>
                            <asp:TextBox ID="txtBrandName" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="lblBrandHeadquater" Text="Headquater" runat="server" />
                        </td>
                        <td>
                            <asp:TextBox ID="txtHeadQuarter" runat="server" />
                        </td>
                    </tr>
                   <tr>
                        <td>
                            <asp:Button ID="btnUpdate" runat="server" OnClick="btnUpdate_Click" Text="Update" />
                        </td>
                    </tr>
                </table>
                <asp:Label ID="lblErrorMessage" runat="server" />
            </fieldset>
        </asp:Panel>
    </div>
    </div>
</asp:Content>

推荐答案

(#dialog_form)。parent()。appendTo(
("#dialog_form").parent().appendTo(


(#form:first));
("#form:first"));

然后是对话框以及页面n。








then both the dialog as well as page diabled.





document )。ready( function (){

var myDialog =
(document).ready(function () { var myDialog =


这篇关于我无法在jquery对话框中使用asp控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆