第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何在動(dòng)態(tài)創(chuàng)建的ASP.net控件中動(dòng)態(tài)創(chuàng)建ASP.net控件

如何在動(dòng)態(tài)創(chuàng)建的ASP.net控件中動(dòng)態(tài)創(chuàng)建ASP.net控件

C#
尚方寶劍之說(shuō) 2019-11-04 13:00:29
我正在用ASP.net制作應(yīng)用程序。我有一個(gè)按鈕,單擊后會(huì)生成一些html,一些asp文本框和一個(gè)asp按鈕(第二個(gè)按鈕)。據(jù)我所知,這工作正?!,F(xiàn)在我想要的是,當(dāng)我單擊第二個(gè)新創(chuàng)建的按鈕時(shí),我希望它創(chuàng)建一些html + asp.net文本框。這讓我感到困惑,有沒有更簡(jiǎn)單的方法?我似乎無(wú)法弄清楚,我為按鈕2創(chuàng)建了onclick事件,但它尚不存在。非常感謝。認(rèn)為以防萬(wàn)一,您想看一下代碼可能會(huì)容易一些,以防萬(wàn)一。namespace ConnorMackayWebForm{public partial class InspectionCreate : System.Web.UI.Page{    protected void Page_Load(object sender, EventArgs e)    {        //Set the initial amount of areas and hazards        int areaCount = 0;        int hazardCount = 0;        //Check if the viewstate with the area count already exists        if (ViewState["areaCount"] != null)        {            //Convert the view state back to an int            areaCount = Convert.ToInt32(ViewState["areaCount"]);        }        else        {            ViewState["areaCount"] = areaCount;        }        //Check if the viewstate with the hazard count already exists        if (ViewState["hazardCount"] != null)        {            //Convert the view state back to an int            hazardCount = Convert.ToInt32(ViewState["hazardCount"]);        }        else        {            ViewState["hazardCount"] = hazardCount;        }        //Create the required number of areas        for (int i = 1; i <= areaCount; i++)        {            createArea(i);        }        //Create the required number of hazards        for (int i = 1; i <= hazardCount; i++)        {            createHazard(i);        }    }    protected void btnCreateArea_Click(object sender, EventArgs e)    {        //Get the current number of areas        int areaCount = Convert.ToInt32(ViewState["areaCount"]) + 1;        //Create the area        createArea(areaCount);        //Set the new area into the viewstate        ViewState["areaCount"] = areaCount;    }
查看完整描述

3 回答

?
繁花如伊

TA貢獻(xiàn)2012條經(jīng)驗(yàn) 獲得超12個(gè)贊

再次感謝您的所有幫助?,F(xiàn)在我唯一的問題是使所有這些都與viewstate一起使用。例如,我將命令參數(shù)傳遞給createbutton方法。現(xiàn)在,在要讓其在重新加載時(shí)創(chuàng)建這些按鈕的viewstate中,它希望傳入相同的命令參數(shù),因?yàn)樗\(yùn)行用于在重新加載時(shí)創(chuàng)建按鈕的相同方法?,F(xiàn)在有一種方法可以讓我將這些按鈕放置在重新加載的正確位置嗎?萬(wàn)分感謝

查看完整回答
反對(duì) 回復(fù) 2019-11-04
  • 3 回答
  • 0 關(guān)注
  • 363 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)