c# - ASP.NET label is null -
i'm trying make website c#. i've masterpage , there devexpress dateedit, 4 devexpress dropdownlists, 1 button , 1 label. i've method this:
protected void dropdownnolar_selectedindexchanged(object sender, eventargs e) { var halisaha = (from veri in veriler.tum_halisahalars veri.il == dropdownil.text && veri.ilce == dropdownilce.text && veri.mahalle == dropdownmahalle.text && veri.no == dropdownnolar.text select veri).firstordefault(); if (halisaha != null) if (halisaha.description != null) lbldescription.text = halisaha.description; }
and masterpage's aspx code:
<%@ master language="c#" autoeventwireup="true" enableviewstate="true" codebehind="~/masterpage.master.cs" inherits="halisahakiralama.masterpage" %> <%@ register assembly="devexpress.web.v14.1, version=14.1.6.0, culture=neutral, publickeytoken=b88d1754d700e49a" namespace="devexpress.web.aspxeditors" tagprefix="dx" %> <!doctype html public "-//w3c//dtd html 4.01 transitional//en"> <html> <head id="head1" runat="server"> <title>untitled</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <meta name="generator" content="web page maker"> <style type="text/css"> #wrapper { position:relative; width: 1127px; margin-top: 20px; margin-left: auto; margin-right: auto; text-align:left; top: -2px; left: 55px; height: 1000px; background-color:sandybrown; } .auto-style1 { width: 100%; height: 912px; border: 5px solid #ffffff; background-color: #66ff33; } .auto-style2 { height: 792px; } .auto-style4 { height: 130px; border:thick none white; } .auto-style5 { height: 792px; width: 237px; } </style> </head> <body style="margin:0px; height: 1093px; background-color:sandybrown" onload=""> <script type="text/javascript" language="javascript"> </script> <form id="form1" runat="server"> <div id="wrapper"> <table class="auto-style1"> <tr> <td class="auto-style4" colspan="2" style="background-color:lightseagreen"> <div style="border-style: none; border-color: inherit; border-width: thick; z-index: 1; left: 8px; top: 9px; position: absolute; height: 130px; width: 1111px;"> <img src="hs2.jpg" style="position:absolute; top: 6px; left: 33px; width: 157px;" alt="" /> <dx:aspxlabel id="aspxlabel6" runat="server" font-size="36pt" style="z-index: 1; left: 226px; top: 31px; position: absolute; height: 82px; width: 505px" text="bamyacılar halısaha" theme="youthful"> </dx:aspxlabel> </div> </td> </tr> <tr> <td class="auto-style5" style="background-color:darkgreen"> <div style="position:absolute; top: -13px; left: 8px; width: 236px; height: 639px; background-color:transparent"> <asp:contentplaceholder id="contentplaceholder2" runat="server"> <dx:aspxdateedit id="date_edittarih" runat="server" date="2015-03-24" font-size="16pt" style="z-index: 1; left: 18px; top: 196px; position: absolute; height: 21px; width: 170px" theme="youthful"> </dx:aspxdateedit> <dx:aspxlabel id="aspxlabel1" runat="server" font-size="12pt" style="z-index: 1; left: 18px; top: 165px; position: absolute" text="İstediğiniz tarihi seçiniz:" theme="youthful" forecolor="white"> </dx:aspxlabel> <dx:aspxcombobox id="dropdownil" runat="server" style="z-index: 1; left: 18px; top: 280px; position: absolute; height: 29px; width: 170px" theme="youthful" onselectedindexchanged="dropdownil_selectedindexchanged1" nulltext="İl seçiniz!"> </dx:aspxcombobox> <dx:aspxlabel id="aspxlabel2" runat="server" font-size="12pt" style="z-index: 1; left: 18px; top: 478px; position: absolute" text="stat numarasını seçiniz:" theme="youthful" forecolor="white"> </dx:aspxlabel> <dx:aspxcombobox id="dropdownilce" runat="server" style="z-index: 1; left: 17px; top: 353px; position: absolute; height: 29px; width: 170px; bottom: 727px;" theme="youthful" onselectedindexchanged="dropdownilce_selectedindexchanged1" nulltext="İlçe seçiniz! "> </dx:aspxcombobox> <dx:aspxlabel id="aspxlabel3" runat="server" font-size="12pt" style="z-index: 1; left: 18px; top: 249px; position: absolute" text="İlinizi seçiniz:" theme="youthful" forecolor="white"> </dx:aspxlabel> <dx:aspxcombobox id="dropdownmahalle" runat="server" style="z-index: 1; left: 17px; top: 431px; position: absolute; height: 29px; width: 170px" theme="youthful" onselectedindexchanged="dropdownmahalle_selectedindexchanged1" nulltext="mahalle seçiniz! "> </dx:aspxcombobox> <dx:aspxlabel id="aspxlabel4" runat="server" font-size="12pt" style="z-index: 1; left: 18px; top: 322px; position: absolute" text="İlçenizi seçiniz:" theme="youthful" forecolor="white"> </dx:aspxlabel> <dx:aspxcombobox id="dropdownnolar" runat="server" style="z-index: 1; left: 18px; top: 510px; position: absolute; height: 29px; width: 170px" theme="youthful" onselectedindexchanged="dropdownnolar_selectedindexchanged" nulltext="numara seçiniz!"> </dx:aspxcombobox> <dx:aspxlabel id="aspxlabel5" runat="server" font-size="12pt" style="z-index: 1; left: 18px; top: 400px; position: absolute" text="mahallenizi seçiniz:" theme="youthful" forecolor="white"> </dx:aspxlabel> <dx:aspxbutton id="btnmasterpagedevamet" runat="server" font-size="12pt" style="z-index: 1; left: 18px; top: 555px; position: absolute" text="devam et" theme="plasticblue" onclick="btnclickeski01"> </dx:aspxbutton> </asp:contentplaceholder> </div> <br /> </td> <td class="auto-style2"> <div style="z-index: 1; left: 257px; top: 144px; position: absolute; height: 784px; width: 862px;background-color:#9acd32"> <asp:contentplaceholder id="contentplaceholder1" runat="server"> <p> <br /> </p> <p> </p> <p> </p> <p> <dx:aspxbinaryimage id="aspxbinaryimage1" runat="server" style="z-index: 1; left: -237px; top: 443px; position: absolute; height: 109px; width: 155px"> </dx:aspxbinaryimage> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p style="margin-left: 0px"> </p> <asp:label id="lbldescription" runat="server" forecolor="white" font-names="comic sans ms" style="z-index: 1; left: -226px; top: 583px; position: absolute; height: 14px" text="açıklama"> </asp:label> <p> </p> <p> </p> <p> </p> </asp:contentplaceholder> </div> </td> </tr> </table> </div> </form> </body> </html>
dropdownlists aren't null, label is. why happens?
looking @ code sample. in stage 'postback event handling'. in stage controls should ready use.
question might cause unexpected behavior , how find out issue? here masterpage run-time behavior:
- users request page typing url of content page(.aspx page)
- when page fetched, @ page directive read. if directive references master page, master page read well. if first time pages have been requested, both pages compiled.
- the master page updated content merged control tree of content page.
- the content of individual content controls merged corresponding contentplaceholder control in master page - in other words content control .aspx page replacing placeholder content masterpage.
- the resulting merged page rendered browser.
question went wrong in flow. why control in masterpage set null? *you have added code inside placeholder on masterpage replace content control , can end null values.
hope you.
Comments
Post a Comment