Getting the data out of the data Formview - vb.net

I have an ASP pg with a formview list control on it that hooks up to a sql database customer table
I want to access the customer name outside the form.
How do I:
A) access the bound text box in the form view template? Something like Text1.text=formview1.customername.text (that doesn't work but that's the kinda thing)
B) access the database field in the table that the sqlsource connects to to feed the formview
Really appreciate the help. I bet it's easy to do but I'm just not getting there.

You are going to want to use the DataBinder Class. For example:
<asp:formview id="formViewContainer" ... other code>
..... formview code .....
<%# Eval("CustomerName") %>
..... more formview code .....
</asp:formview>
Then to access "CutomerName" outside of the formview use the DataBinder as follows:
<asp:textbox id="customerName" runt="server"
text='<%# DataBinder.GetPropertyValue(formViewContainer.DataItem, "CustomerName") %>' />

Related

How to loop for each record in One2Many field in form view to create dynamic elements?

I have a customized One2Many field that contains several records for this current data.
I am working on a form view.
I need to construct something like this: (I don't want a tree)
<for every record in one2many_field>
<button something...>
</for>
I only want the result as to create 1 button per record in the one2many_field and be able to get the data in some fields from the model of the one2many_field too.
Is there any way to achieve it? I have searched for some time but found nothing even remotely close to this requirement.
You won't be able to achieve that in a Form View. Views in Odoo are kind of strict but it's mostly to avoid bad stuff to happen.
Anyway, you could think about re-creating the full view by yourself using QWeb View (doc for v14 here)
If you want to keep your Form View, you'll have to use a tree inside the form.
Know that you can totally add buttons in Tree views like adding on a sale.order.line something like <button class="btn btn-primary" type="object" name="product_id_change" string="Force Product Id Change"/> (useless, just for the example)
Check example image here
And play with some attrs to change the visibility of fields...
Hope it helped :)

How to populate a webform variable

I'm attempting to use VB.Net WebBorwser to populate and submit a webform. I'm using webbrowser because I don't know much javascript or c#. I'm open to other ideas of course.
I'm able to populate the form fields easily enough:
m_oWebBrowser1.Document.GetElementById("line1").SetAttribute("value", "Flat 12")
but this isn't enough to trigger the page to set the require variables. I've also tried:
m_oWebBrowser.Document.GetElementById("line1").InvokeMember("change")
and
m_oWebBrowser.Navigate("javascript: PreviousAddress().Address().Line1='Flat 19';")
The input field looks like this:
<input id="previousAddressLine1" class="col-xs-12 col-sm-8" name="previousAddressLine1" tabindex="12" data-bind="value: PreviousAddress().Address().Line1" type="text">
Any help would be great.
-Ben

Update certain data in SQL with JSP

i've been learning web programming (JSP and SQL) for the past few days, i need help with certain problem, so i need to show the list of all name of members from my database, add button beside it, and when i click it, i need to update the data in database, which name is exactly the same name besides the button .
I have successfully show the data and button, and i know syntax for updating in SQL, but i have no idea how to validate when i click the button, it updates the data with the same name exactly besides the button. Let's just pretend all name is unique. This is my sample code:
<div id="textArea">
<%
String query = "SELECT * FROM member";
ResultSet rs = st.executeQuery(query);
while(rs.next()){%>
<table>
<tr>
<td><%out.print(rs.getString("Fullname"));%></td>
<td> <input type="button" value="Change Role"/> </td>
</tr>
</table>
<%
}
%>
</div>
Any help is really appreciated. thanks!
You have to write Java code in a JSP Page for updating certain data from JSP.
You can write Java Code inside a scriptlet in a JSP page.
You have to write scriptlet inside <% ...%> tag, Please see sample below:
<%
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test");
Statement st=con.createStatement();
......
%>
Please follow the post below to execute update query directly from JSP:
Jsp sql update query

How to pass parameter to RDLC report

I am new to reports creation in ASP.net (Local Report). I have used rdlc file to create my report. Objective is, On clicking of the reservation button in a aspx page, the data has to be stored in db and page should open a popup window to show the report (saved details) to the user.
I have created a rdlc file and created/added a parameter too.
my Aspx page:
<rsweb:ReportViewer ID="ReportViewer" runat="server" Font-Names="Verdana" Font-Size="8pt"
ZoomMode="PageWidth" InteractiveDeviceInfos="(Collection)" WaitMessageFont-Names="Verdana" ProcessingMode="Local"
WaitMessageFont-Size="14pt" PageCountMode="Actual" Width="750px" Height="500px">
<LocalReport ReportPath="Reports.rdlc" EnableExternalImages="true"
EnableHyperlinks="true">
<DataSources>
<rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1" />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetPaymentVoucherDetailsByWSId"
TypeName="Controllers.ReservatoionController">
</asp:ObjectDataSource>
Controller.cs
Created a public method that accepts the Primary key of the record and return the object to the report.
Query:
How do I pass the primary key from main page to Controller class to get the result?
how to set the primary key value dynamically to report?
Check Below Link It shows a demo for pass parameter value
www.youtube.com/watch?v=ko1Uejtdi1g

VB.net dynamic table ID

I'm dynamically populating a table via VB.NET using jQuery and ajax but I need the physical table ID to change to fire table specific events on the front end that will be recognized by jQuery.
I've googled and tried passing a variable without any any success. It is possible to load a table dynamically and change the displayed ID in vb.net?
<asp:Table ID="<%=dynamicTableID%>" runat="server"> </asp:Table>
any feed back ins appreciated.
Thanks,
You may want to use the data attributes for something like this. Instead of parsing out a dynamic id you can do something like
<asp:Table ID="<%=myId%>" runat="server" data-src="<%=someUniqureAttr%>"> </asp:Table>
You can access this field in jquery like this
$('table').data("src")
And use a selector like this
$('table[data-src="myUniqueAttr"]')