|
So you just want to expose an event from your custom control?
public class CusParamTextBox : BaseParam
{
public event EventHandler ExposedUpdate;
protected virtual void OnExposedUpdate(EventArgs e)
{
var handler = ExposedUpdate;
if (handler != null) handler(this, e);
}
...
private void ParamTxtBox_TextChanged(object sender, EventArgs e)
{
...
OnExposedUpdate(e);
}
}
...
var tmpctrlx = new CusParamTextBox();
tmpctrlx.ExposedUpdate += Update;
...
protected void Update(object sender, EventArgs e)
{
var cuscontrol = (CusParamTextBox)sender;
DoSomethingOnPage(cuscontrol.name, cuscontrol.value);
upMain.Update();
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
modified 14-Aug-13 10:02am.
|
|
|
|
|
Yes, I want to expose a event that I can hook too.
So, I can tell it to fire in the local control... but pretty much do nothing locally... but then hook it to a page event that will do the heavy lifting.
=)
|
|
|
|
|
So, pretty much exactly the example I posted then?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Yes, Thank you so much!
That is working like a charm!
=)
|
|
|
|
|
Ok, I do have a new problem now..
It seems when I put this code into my update panel...
It continues to do a full post back all the time...
Any idea how how to solve this any one ?
Thanks!
=)
|
|
|
|
|
Have you added an AsyncPostBackTrigger[^] for the control?
<asp:UpdatePanel runat="server" UpdateMode="Conditional">
<ContentTemplate>
<uc:CusParamTextBox ID="CusParamTextBox1" runat="server" OnExposedUpdate="Update" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="CusParamTextBox1" EventName="ExposedUpdate" />
</Triggers>
</asp:UpdatePanel>
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I did try something like that, but a little different because I am adding the controls dynamically to a existing update panel.
I did try but with no luck..
CusParamTextBox tmpctrlx = new CusParamTextBox();
tmpctrlx.ExposedUpdate += new EventHandler(UpdateText);
ScriptManager1.RegisterAsyncPostBackControl(tmpctrlx);
CusParamControls.Controls.Add(tmpctrlx);
and on the page that contains the dyn control
<asp:UpdatePanel runat="server" ID="upMain" Visible="true" ChildrenAsTriggers="true" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel runat="server" ID="CusParamControls"></asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
=)
|
|
|
|
|
Sorry, I'm not overly familiar with the UpdatePanel . You might be better off posting this new issue in its own thread.
NB: It would be better to post the question in the ASP.NET forum[^].
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
modified 14-Aug-13 14:30pm.
|
|
|
|
|
Hi Rich,
Its ok, I manged to figure it out..
I wanted to add the solution to the post too so other may do the same.
Right after your add your control, and then your event via the init...
If you want to put your control inside a update panel and stop a full page post back then you must register your control with the parent page and do it inside the actually control code itself... outside dont seem to work via the main page containing the control.
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
ScriptManager script = ScriptManager.GetCurrent(Page);
TxtParamValue = new TextBox();
TxtParamValue.TextChanged += new EventHandler(TxtParamValue_TextChanged);
if (script != null) { script.RegisterAsyncPostBackControl(TxtParamValue);}
base.Controls.Add(TxtParamValue);
}
Thanks, and enjoy all!
=)
|
|
|
|
|
Hi All,
First time posting here, long time programmer..
So, I have a need for custom controls that I am using to dynamically render a list with call backs..
So, far I had no problem doing simple inherited based controls and hooking their callbacks...
IE CusControl : TextBox...
Then its fairly easy to hook the TextChanged event and add the controls a dynamic list and catch the post backs.
Now, the hard part is
=)
|
|
|
|
|
Hi, you might want to edit your post. Your post finishes at "Now, the hard part is" - and we can't guess what the hard part is.
|
|
|
|
|
For future reference. If you need to update a post, don't create a new one, simply hit the edit button and fix your original post.
|
|
|
|
|
|
|
what are the object oriented system concept used in c#....??
|
|
|
|
|
|
Get a book on OOPS concepts and read.
|
|
|
|
|
C++, Java, C# - All good Oops based programming languages. Are looking for something specific on C#? You will get only funny replies when you post such a generic questions...
|
|
|
|
|
Hi,
I have created a project with a third party control which has a distributable license.When I create a set up to this project and when I implement in other place it works fine.
At the same time when I add the dll files to another existing project and try to integrate both the project I get license issue. The message I receive is control expired error.
Though the license file is embedded with the dll.
Regards,
N.ShanthaKumar.
|
|
|
|
|
You need to go back to the people who provide the third party control.
Use the best guess
|
|
|
|
|
Hi,
I have installed a windows service in any of the work station in my network.
It sends emails periodically.
I want to remove the service, But I forgot the Node where i installed it.
Now every morning I m getting emails as result of that windows service.
Can you tell me how to trace, where this service is installed, so that I can remove it.
Thanks
By:
Hemant Thaker
|
|
|
|
|
I have no idea what type of mail server you are using, but looking into the log files and mail storage you should be able to work out where from the email was sent.
Regards,
— Manfred
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
Short the Installed program in Add/Remove section of Control panel with date.
|
|
|
|
|
I am developing a project(ASP.NET & C#) containing Digital Signature. I can sign a document using PFX file. Is it possible to digitally sign a PDF file using USB token through C# program? If yes, please give me sample code ..
Thanks in advance
Shiny
|
|
|
|
|
dsshiny wrote: Is it possible to digitally sign a PDF file using USB token through C# program? It's possible to sign a PDF using a certificate, and yes, that can be built with C#. What USB-token? If that's what contains the certificate, then you'd be writing some additional code to read from it.
dsshiny wrote: If yes, please give me sample code .. There's quite some examples on digitally signing a PDF. I suggest you start there
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|