मैंने एक वेब पेज के लिए दो आंशिक कक्षाएं बनाई हैं।क्या मैं एक आंशिक वर्ग में परिभाषित एक फ़ंक्शन को किसी अन्य आंशिक वर्ग से कॉल कर सकता हूं। क्या यह संभव है?
अब मैंने एक फ़ंक्शन की परिभाषा सबमिट की है (सबमिट करें) कि मैं बटन के ऑनसबमिट ईवेंट पर कॉल कर रहा हूं।
लेकिन इस फ़ंक्शन को नहीं कहा जा रहा है, प्रोग्राम संकलित नहीं करता है क्योंकि यह फ़ंक्शन की परिभाषा को खोजने में सक्षम नहीं है, जिसे किसी अन्य आंशिक वर्ग में परिभाषित किया गया था। क्या यह संभव है इस समारोह कॉल करने के लिए या मैं एक ही फाइल में समारोह की defination देने के लिए जहां im यह
जैसे
<%@ Page Language="C#" MasterPageFile="~/Master Pages/LeftMenu.master" AutoEventWireup="true" CodeFile="Registration.aspx.cs" Inherits="Web_Pages_Authentication_Login_Management_Registration" Title="Registration" StylesheetTheme="Default Theme 1" %>
Registration.aspx.cs
public partial class Web_Pages_Authentication_Login_Management_Registration : System.Web.UI.Page
{
private string firstName;
private string lastName;
private string userName;
private string userPassword;
private string primaryEmail;
protected void btnSubmit_Click(object sender, EventArgs e)
{
Display();
}
}
Registration_Database.cs
बुला हैpublic partial class Web_Pages_Authentication_Login_Management_Registration
{
const string dbFirstName = "@FirstName";
const string dbLastName = "@LastName";
const string dbUserName= "@UserName";
const string dbUserPassword = "@UserPassword";
const string dbPrimaryEmail = "@PrimaryEmail";
void Display()
{
firstName="XYZ"; //This variable is not accessible when i put both files in different directories
}
}
मुझे निम्नलिखित त्रुटि मिल रही है
Error 1 'Web_Pages_Authentication_Login_Management_Registration' does not contain a definition for 'Display' and no extension method 'Display' accepting a first argument of type 'Web_Pages_Authentication_Login_Management_Registration' could be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Administrator\Desktop\Online Test\Web Pages\Authentication\Login Management\Registration.aspx.cs 78 20 C:\...\Online Test\
Registration.aspx, Registration.aspx.cs, Registration_Database.cs तीन फ़ाइलों को App_Code फ़ोल्डर में नहीं हैं, लेकिन केवल जिसमें से एक फ़ोल्डर के अंतर्गत आता है Registration.aspx.cs, Registration_Database.cs आंशिक वर्गों रहे हैं और पंजीकरण.एएसपीएक्स मेरी डिजाइन फाइल है। कृपया मुझे बताएं कि क्या आप मेरी समस्या के बारे में कुछ और जानकारी जानना चाहते हैं
मैं DLL फ़ाइलों का उपयोग नहीं कर रहा हूं। कोई precompiled कोड
सभी उत्तर एक ही चीज़ की जांच कर रहे हैं लेकिन मैं जानना चाहता हूं कि मैं अपना नामस्थान कैसे देख सकता हूं। क्योंकि पेज कोड –
में मेरे लिए कोई नेमस्पेस दिखाई नहीं दे रहा है क्या आपके पास इन दोनों वर्गों को समान नामस्थान के अंतर्गत एक ही असेंबली (डीएलएल) में है ...? आंशिक कक्षाएं विभिन्न असेंबली और विभिन्न नामस्थानों पर wok wont ... – RameshVel
मैं यह जांचने में सक्षम नहीं हूं कि वे दोनों एक ही असेंबली या नामस्थान में हैं या नहीं। मैं यह –