i have 3 user control in my page . one of this user control is about fileUploading and second is about fileUploade Keyword . when file uploaded the fileUploading usercontrol return an Id of the recorded that insert . now i want to use this id in fileUploaded keyword but when is insert to label for seeing the id in fileuploading user control show right id forexample 1 or 2 or .. but in keyword usercontrol show only 0 value . i use entity frame work . how can i access this id in keyword user control .
thanks.
i have 3 user control in my page . one of this user control
Share
You can use a delegate to pass the id back to the parent page. When the id is passed back to the parent page, you run a function on the parent page that invokes a public function on the keyword usercontrol.
So on your Uploading usercontrol, first create the delegate that the parent page will listen for:
Next, fire the delegate once you have the id returned:
Now you need to setup the listener on the parent page. Once the listener executes, it will execute the “PassID” function. In this function, you will be calling the public function “LoadID” of the keyword usercontrol. So on the parent page, do this:
And the code for your keyword usercontrol would look like this:
Here is some more info regarding the use of delegates: http://webdeveloperpost.com/Articles/Return-value-from-user-control-in-ASP-NET-and-C-Sharp.aspx
Hope that helps! Good Luck! Don’t forget to mark as answer!