I am loading a usercontrol in code-behind as show below
Dim AdjFormctl As UserControl = CType(LoadControl("~/Controls/AdjForm.ascx"), UserControl)
Dim EMPFormType As Type = AdjFormctl.GetType()
Dim EMPPK As PropertyInfo = ABCFormType.GetProperty("employeePK")
AdjFormctl.ID = "ucAdjForm"
EMPPK.SetValue(AdjFormctl, Convert.ToInt32(txtEMPPK.Text), Nothing)
phSettlement.Controls.Add(AdjFormctl)
though it is loading properly. When I hit the submit button that is in the usercontrol it is not going inside the buttonclick event and wiping out the usercontrol from the page.
Please help
Where did you put this code? If you put in the event handler for submit button, the control will ONLY be generated when the submit button is pressed.
It means that you will only see it in the browser when the page comes back after you pressed the button. The html generated as a result of any other action will not have it.
If you want the control to stay you will have to include this code somewhere else i.e. OnLoad event or PreRender event
Related
APP.js Snapshot
contact.jade snapshot
Snapshot of Page on Chrome
When I click on Submit button nothing happens control stays on same page.
I am realy stuck at this point, any help will be apprecaited.
Thank you
You need to ensure your button is inside the form tag by indenting it.
form
button
This translates to the HTML
<form>
<button></button>
</form>
which allows the button to know which form it should submit.
As your code stands now it is
<form></form>
<button></button>
For which the button does not have a parent form.
(You similarly need to this for your input's... otherwise they won't be sent to the endpoint.)
So i have my main form and i open a second form using this code
this->Hide();
Form2^ dlg=gcnew Form2();
dlg->ShowDialog();
how do i go back from the second form to the main one?
In the dialog code set the DialogResult property, this will close the dialog and return to the main form, ShowDialog will return the DialogResult value you set.
Alternatively you can have a button on the dialog that has a DialogResult property set and then clicking the button will close the dialog and return the value associated with the button.
I am new to WinJS, and I want to make a ContentDialog that will contain a textbox, for entering an API key and Submit and Cancel buttons. When the ok button is clicked, a method should be triggered that will do a bit of validation and then persist the data. I have been trying to find out how I can add an event listener to one of the ContentDialog buttons but cannot find out how. I have been googling, and found:
http://try.buildwinjs.com/#contentdialog
https://msdn.microsoft.com/en-us/library/windows/apps/dn904229.aspx
https://mindfiremobile.wordpress.com/2013/08/27/displaying-dialogs-in-winjs/
None of these hint on how to accomplish this. Can this be done? If so how?
in your JS code add:
var button1 = document.getElementById("button1");
button1.addEventListener("click", button1Click, false)
'button1' is the id of the HTML element.
'button1Click' is your js function to perform the action.
I have a User Control in VB.NET (VS 2010) inherited from a picturebox. I also have a class that holds 40 or so properties for the control. I also have a form with a property grid that is used as an editor. The editor form opens when clicking the "Custom" property of the control in the IDE. On the form are an OK and Cancel button which either saves or discards changes.
All of this works fine, but I need to have my control "refresh" when a property changes in the grid. The property grid has an event for this, but I don't know how to call or invoke my sub in the control to essentially repaint the control. If I call the sub directly nothing refreshes on the control until after I close the editor form (dialog). Is there a way to have the control repaint/redraw with the editor dialog still open?
Thanks,
EluZioN
Try using Context.Instance which is passed when your UI_Editor is invoked. In the GetEditStyle override, a Context object is passed. This holds a reference to the calling UserControl.
I do something like this (CUSTOM UI_TYPE_EDITOR):
Dim ContextOBJ as MyUserControl
Public Overrides Function GetEditStyle(ByVal context As System.ComponentModel.ITypeDescriptorContext)......
contextOBJ = CType(context.Instance, MyUserControl)
In the GetEditValue override, you can call ContextOBJ.Refresh and your UserControl should immediately reflect any changes. It works for me.
I have a user control (ascx) inside a page (aspx). The ascx has JQGrid placed. I have a button in the page. On click of button I show AJAX modal popup.
The problem is: On click of button, document.ready in ascx is also getting called which in turn loads the JQGrid. I would like to avoid this.
To summarize, I do not want to reload JQGrid inside the ascx when post back happens from hosting page.