VB.NET Dynamic creation of Details View with a web panel - vb.net

Every time i enter set of values like Group Name,Group Abbreviation,URL in the text boxes and click the save button automatically its saves in the database and for each set of values a new details view has to be generated dynamically with a web panel and the header of the web panel should have the value of Group Name.
Example:
Group1
Name Group1
Abbreviation G1
URL http://stackoverflow.com
Group2
Name Group2
Abbreviation G2
URL http://stackoverflow.com
A new details view with web panel like the above has to be generated every time the save button is clicked.
Thanks in Advance.

This solution assumes each group is a single database record.
Use a datasource which pulls all of the IDs for the groups that should be displayed on the page.
Create a repeater control and set its datasource to the datasource created in step 1
Add a hidden input field to the content template for the repeater control. Bind it's value to the group's id.
Add a details view control to the repeater control template.
Add a datasource to the repeater control template that returns a group record filtered on the hidden input control.
When you submit a new group, make sure to rebind the data on the repeater control created in step 2.
Alternatively, it would be much easier to just use a listview if possible.

Related

How to use Attachment Image from Table in Access Form and Report Headers?

I have an Access database used by many projects and each project have its logo and information stored in table called company_info_tb.
I stored the logo in Attachment field type; each project can modify its info and logo to be used in its printed reports.
How I can call the project logo to be shown in the headers of Access forms and reports using a Bound Object Frame or another way?
I tried using dlookup in the Control Source of the Bound Object Frame:
Dlookup("LOGO","company_info_tb")
And using LOGO that was shown in mainform, by putting this code in the Control Source:
=forms!main_frm!LOGO
But it doesnt work.
Options:
include logo attachment field table in report RecordSource, without a join clause the logo record will associate with each record of data table/query (Cartesian relationship), place bound control only in header section - not appropriate for data entry/edit form because the resulting query is not updatable
save the logo image externally and store path in text field then use DLookup expression or Cartesian query
subform/subreport in header
Recommend using Image control and set its ControlSource property either by binding to attachment field or text field or expression to construct external path. A BoundObjectFrame control must be bound to an OLEObject field and options 1 or 3 would work.

How to make a total column that updates automatically in Access.

In access I am trying to get my total value to be equal to the sum of the all of the different values where the order number is the same.
My current code is as follows;
= SUM( Forms![OrderLine]![Total] ) Where( Forms![OrderLine]![OrderNo] = [OrderNo] )
This however gives me an error. How else would this be done?
Thanks
It sounds like you have an Order form and an OrderLine subform. Add a Form header/footer to your OrderLine form and put a text box in the footer. Put a SUM function in the Control Source of the footer text box to generate the aggregated value you need from the order line item rows.
On your main form, set the Control Source of the text box you want to display the order total equal to the name of the invisible text box in the subform. The control source on the main form text box will resemble SubformControlName.Form.AggregateTextBoxName.
You may need to play with the visibility settings of the header/footer, text box, form view mode, etc. to get the presentation you want, but this works even with the subform in datasheet view. The key is to get a text box somewhere on the subform to calculate the value you need on the parent form and then reference it inside the subform control from the parent form.

dojo form submit on change of value

I have a dojo table container embedded within dojo form. I'm able to validate all dijits like textbox, combobox etc and submit the form. But what I need is, submit the form only when a value is changed i.e. if a textbox value is changed, submit the form else don't.
Add a hidden text input field which is empty while loading page. Then After you make a change in your text field check the content in the hidden text field and your respective text field if they are same then don't submit the form.
Dojo input fields maintain the original value in the private attribute of '_resetValue'. Before submitting the form, you can check whether _resetValue is different from .get('value') and submit the data..
If all the attributes are under the Table container, you can fetch the children of the table containers and verify using array.every() function..
var unmodified = array.every(container.getChildren(), function(widget){
return widget._resetValue == widget.get('value');
});

Calling a Control on a subform

I'm looking for a way to access a control on a subform, currently everything I have tried gives me an error of "cannot find".
my main form "frm_View" contains the subform "subform_View2"
subform_View2 contains a tab container
the tab container contains yet another subform "subform_View3" on the
first tab
Separate form "frmAnswers"
I need to access a control on subform_View3 in order to insert information obtained from frmAnswers.
I've tried:
me.subform_view3!frm_View!control1
me.subform_view3!subform_view2!subform_View3!control1
The thing is that you must treat the tab control as a special kind of container, with each page behaving similarly to another subform.
I have created an example, see picture below.
The main form contains a TabControl (named tabControl) and the first page contains a subform (called SubForm) and that contains a text box (txb).
To get to the value of the text box you will need to path through the tab control like this:
Me.tabControl.Pages(0).Controls("SubForm")!txb.Value
or
Me.tabControl.Pages("Page1").Controls("SubForm")!txb.Value
or
Me.tabControl.Pages("Page1").Controls("SubForm").Controls("txb").Value
Notice that the SubForm is part of the "Controls" collection of the page, so you'll need to identify the tab control first, then the page (either by name or zero-based index) and then the subform itself to get to it's controls.
EDIT
If you want to call it from a form-independent code, you can target the form like this
Forms!MainForm!tabControl.Pages("Page1").Controls("SubForm")!txb.Value

Edit DataGrid row redirect to another page with holding the data in the coresponding fields?

I have a Data Grid view with the following colums, in VB.Net
Student Name, Address , Phone etc. and edit hyperlinkfield as well.
When I click on the Edit link on a Row, it should redirect me to studentdetails page and carrying the row value to the corresponding controls like Nametext , addresstext, phonetext controls etc.
I am new to vb.net and datagridview. Can anyone let me know how this works?
Thanks in advance
Place code to open the new form/page in the hyperlinkfield's click event. To access the other information from the same row you can use
DataGridViewName.CurrentRow.Cells(studentName).value
or
DataGridViewName.Rows(e.rowIndex).Cells(studentName).value
Then you get these values for the current row and pass them to whatever method in launches your new page, or set as properties on the edit form.