c# - Preventing page from refreshing aspx.net -


मेरे पास एक एएसपीएक्स पेज है:

  & lt;% @ पृष्ठ भाषा = " सी # "कोडबेहिन्ड =" xxxx.aspx.cs "इनहेरिट्स =" xxxx "% & gt; & Lt;; DOCTYPE HTML PUBLIC "- // W3C // डीटीटी एक्सएचटीएमएल 1.0 ट्रांसक्रिप्शन // एन" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> & Lt; html xmlns = "http://www.w3.org/1999/xhtml" & gt; & lt; head id = "head1" runat = "server" & gt; & Lt; title & gt; ड्रॉपडाउनलिस्ट ऑन-चुने गए इंडैक्स परिवर्तित ईवेंट का उपयोग कैसे करें & lt; / title & gt; & Lt; / head & gt; & LT; बॉडी & gt; & Lt; form id = "form1" runat = "server" & gt; & Lt; div & gt; & lt; h2 शैली = "रंग: लाल" & gt; ड्रॉपडाउन सूची: ऑन-चुने गए इंडेक्स बदल गए & lt; / h2 & gt; & Lt; एएसपी: लेबल आईडी = "लेबल 1" रनैट = "सर्वर" फ़ॉन्ट-बोल्ड = "सही" ForeColor = "डोडरब्लू" फ़ॉन्ट-आकार = "बड़ा" & gt; & Lt; / एएसपी: लेबल & gt; & Lt; asp: ड्रॉपडाउन लिस्ट आईडी = "ड्रॉप 1" रनैट = "सर्वर" ऑटोपॉस्टबैक = "सच" ऑन-चुने गए इंडेक्स परिवर्तित = "GetLocationDetails" बैकएंडर = "क्रिमसन" ForeColor = "FloralWhite" onclientselectedindexchanged = "वापसी झूठी;" & Gt; & Lt; / एएसपी: DropDownList & gt; & Lt; / div & gt; & Lt; / प्रपत्र & gt; & Lt; / body & gt; & Lt; / html & gt;   

ड्रॉपडाउन सूची "drop1" के लिए मान "xxxx.aspx.cs" पृष्ठ से डेटाबेस से आबादी है। जब मैं ड्रॉप डाउन बॉक्स से मान का चयन करता हूं "GetLocationDetails" नामक एक समारोह को aspx.cs से कहा जाता है। जब मैं ड्रॉप डाउन बॉक्स से कोई मान दबाता हूं, तो पृष्ठ ताज़ा होता है और पहला मान केवल चयनित होता है पृष्ठ लोड इवेंट में अपनी ड्रॉपडाउन सूची बाँध:

   

सुरक्षित शून्य पेज_लोड (ऑब्जेक्ट प्रेषक, इवेंटआर्ग्स ई) {if (! (IsPostBack)} {// बाइंड करें या कॉल विधि जो ड्रॉपडाउन सूची से जुड़ती है}}

ऑटोपोस्टबैक सेट है true जिससे पूरे पेज को सर्वर पर वापस पोस्ट किया जा सकता है यदि आप IsPostBack को पेज का ट्रैक नहीं करते हैं तो आपके ड्रॉपडाउनलिस्ट को फिर से बाँध दिया जाता है।

Comments

Popular posts from this blog

jsp - No mapping found for HTTP request with URI with annotation config Spring MVC and Jetty -

c# - Roxy file manager in MVC doesn't accept session path -

java - Ajax call to jsp and jsp redirecting to further jsp -