How to get dynamic created table's total column and row using Request.Form in vb.net - vb.net

I am doing my project in Vb.net using MVC 4.0
I have created dynamic table and in that textboxes in td using javascript and now i want to get that table's total row and column as well for further process in Controller function.
How I can get using above using VB.net?
I have used Request.Form but the id of the textboxes in table is created uniquely so first I want to find the total column and row so based on that I can move further and check using for loop.

It seems like if you are generating your table through javascript you should also be able to set the value of a hidden field to the value you are outputting to your totals column. If you created a hidden field with the value set you should be able to access it from the Request collection. If it is not actually in a field that gets posted back you will only be able to access the value from the client-side.
document.getElementById("myInput").value = "Value you are outputting to your "total" cell

[Solved]
I got all the controls on code behind by it's name by using FormCollection just i need to do is post back the form using form action method because with using ajax i am not getting the formcollection in code behind but directly using form action method i can get all the controls name.
These are the textbox ids by which i can get the value just need to do further process like:
For Each _formvalues As String In formcol
formcol(_formvalues)
Next
fomcol is an object of FormCollection,_formvalues is used for moving one by one name coming in formcol and to take the data inside means name just write formcol(_formvalues) that's it.

Related

Can I change the column showing in the same report through a button?

I have a report that opens from like 7 different forms, and I wanted it to show a bit different from each one (not by much, just 1 column).
Is there a way that the report can show different columns from each form or do I have to create the same report 7 times?
To achieve this I would make use of the OpenArgs Property.
Use VBA to pass value through this property to the report. For each different button i would pass a different value Ex. ("ThisLocation", "ThisOtherLocation", "ThisRandomPlace", etc). Then based on the value that is passed in, I would create hidden expression for the columns you don't want to show on "said version";
This solution will create the allusion of 7 different reports, but be One that shows data based upon a value you pass undeneath that the user will never see or have to enter. See below for more information on the OpenArgs Property.
https://www.fmsinc.com/microsoftaccess/Forms/openargs/index.htm
As an alternative to Chance Finley's answer, I suggest passing the values in a multidimensional public array. Making it public enables passing the array within multiple userforms.
Each time you want to show different information in the report, you can overwrite it with the information in the array.
Here you can see how a public array is created:
VBA Public Array : how to?
Best regards

Access VBA Combobox Store Value in Column

I have an MS ACCESS Combo Box and I wish to change the value of one of the columns in a particular row. I get error "object required" when I run this line:
Me.ComboName.Column(12, intUseRow) = myVar
(If I am unable to use the above syntax then you should also know that the row I am trying to change is always going to be the "current" visible row so there may be another way of solving the problem due to this fact).
Thanks!
If you have a recordset that is bound to a Table/Query, you will need to change the underlying data then requery the combobox to see changes.
If you load it manually (like in the form load event) and have the comboBox Row Source Type to "Value List" - you should be able to update it like this:
Copy all the data from the selected row into variables.
Combobox.RemoveItem (selected index)
change the required variable to the new value.
construct the semicolon separated string for the value list entry
combobox.AddItem new-string.
a bit messy, but it works correctly!

BIRT result set values in specific cells

My query returns location_cd(string) and item_count(int). I only need certain rows from the result however and I need them to display in specific places in my layout so I don't think the table solution is going to work. Can I determine where I place the value for a particular row of the result set?
I am using a grid to display values for a number of fields. I cannot seem to be able to get the values from the results to show. The grid is bound to the result set. I even tried binding the cells to the result set but that didn't work either.
I checked in the query editor and there is a result set shown in the Preview so I know the query works. The complete and correct result set shows if I put a table on the page.
I tried inserting a Dynamic Text or Data object in a cell and used the expression:
dataSetRow["location_cd"]=="3SD"?dataSetRow["item_count"]:""
This returns a blank and does not seem to evaluate. I tested it with :
dataSetRow["location_cd"]=="3SD"?dataSetRow["item_count"]:"BLANK"
and got 'BLANK' to appear in that cell.
dataSetRow["location_cd"] and dataSetRow["item_count"] will display the location_cd and item_count from the first row of the result set. row.outer[] did the same thing. Obviously I am just hacking at this report at this point.
A co-worker suggested that she uses a JAVA if-statement in places like this but I could not get that to work either.
Any ideas or suggestions that will get me on the right road??
Thanks
An elegant option would be to use a HashMap storing the result of the dataset.
Declare a report variable named "values", with a new hashmap as default value (see image below)
Fill values in the onFetch script of the dataset: vars["values"].put(row["location_cd"],row["item_count"]);
Insert new data elements at any place of the report with expressions such: vars["values"].get("myFavoriteLocationCD");
Though it is important to note the dataset should be triggered by the report before these data elements.
The particular row you want to display you specify in a "Text" field inside your grid. Just drag and drop a "Text" field inside your grid. If you bound the fields you want to display to your grid, the "Text" field inside the grid inherits the bindings of its parent (the grid), so you can access the bindings automatically in the "Text" field.
You could try following steps, maybe that works.
Don't use "Dynamic Text" field, instead use a regular "Text" field
Ensure the fields of your query which you use, are bound to the grid (you sayed you already did)
Open the "Text" field
Change preselected pull-down entry "Auto" into "HTML"
Change preselected pull-down entry "Formatting" into "Dynamic Text"
Wrap your code in <value-of format="HTML"> your code goes here... </value-of>
Note: You should check in the "Expression Builder" of your "Text" field if you are able to access the fields you bound to the grid. If they are not available sth. went wrong with your binding. Avoid binding query records to cells this will drive you crazy.
If you want to display a list, ensure you didn't set a constant height in the row of your grid. Set the height to 100% than the row takes its height dynamically.
What about the idea to optimize your query, that only get the results you want are displayed, than you don’t need to filter them with java script? If you don’t need the filtered results in another place this would be the cleaner solution in my opinion.

Get Values from Listbox for if functions

Hey guys very new here.
Have a listbox that gets account names from a specific game server using this command line
Dim apikeyinfo As APIKeyInfo = api.getApiKeyInfo()
lstbxCharacters.DataSource = apikeyinfo.Characters
this code gets all the characters in a single account by displaying it in a listbox.
Now i would like to reference a character from the lisbox but not sure how
Any method such as Listbox.Get to get the value and compare it with something else?
Thanks
you can try something like
lstbxCharacters.SelectedItem
Update
To read the data from the listbox I think there are multiple ways (Assuming that it is readable).
-> Usually listbox display strings, so it should work to read to a string variable
Dim a_string as Strin = lstbxCharacters.SelectedItem
also you may like to add a small check before, assuring that an Item is currently selected:
If lstbxCharacters.SelectedIndex < 0 then return
This jumps out of current sub if no item is selected
And finally, to read the first entry, you can also do it this way:
a_string = lstbxCharacters.Items(0)
if it returns objects, then instead of accessing the object directly, it may work to do
a_string = lstbxCharacters.Items(0).ToString
(most objects allow a .ToString() Function )
Here two ideas for different solutions:
As a user commented, you could access the DataSource directly + the information which listIndex was selected. But if you do so, then maybe it is more easy (if you need to access it anyways, to go with solution 2)
Create a variable of type list(Of some_object) and fill it with the data from the datasource. It will take some time to do this, but if you define for the class some_object a function ToString, then you can fill all objects directly to the lstbxCharacters, and access them without any worries, by doing CType(lstbxCharacters.SelectedItem, some_object)
Update 2
If with reference you mean to access further information from the datasource, then you need to build some kind of query, or set the content of the listbox in relation to another control that shows the database content (in that way the listbox lstbxCharacters would act like a filter)

Sharepoint 2010: Update Lookup Field Multiple Value with a Workflow

I want to update a lookup field that contains multiple values through a Workflow, using Sharepoint Designer 2010.
For the moment, the old value is always overwritten, and I would like to "merge" the old value with the new one.
Here is the list of my test by so far:
1) I've managed to Keep the old or the new one, but not both of them.
2) I've tried to add key words like : & ; , between the fields, but only the first element is written in the list ( Example : [%first Element: id%] ;[% Second Element: ID%] --> Result in the column : First Element Id)
I'm out of idea. Do you have any tips?
Do you need more information?
Is this possible to do such things in Sharepoint designer?
Yes this can be done in SharePoint Designer. You need to set both the ID and the lookup value (the text that is displayed in the lookup field) - and these need to be separated by ;#
Build the following as a string before setting it to the lookup value.
[%Current Item:LookupList%];#[%Variable:NewItemID%];#[%Variable:NewItemTitle%]
In the example above, the first item is your original multi-select lookup list. The second, is the ID from the item that you want to add to the lookup, and the third is the title (or the value you're displaying in the field) from the item you're adding.