Is there a way to populate gridView in aspx page with some static Unbound data without making changes to the .vb file?I do not see any settings in the property window, checking to see if someone has the code?
Dim Application = From AL In db.AnnualLeave _ Where AL.Approval <> True _ Select LeaveID, EmpID, Name GridView3.DataSource = Application GridView3.DataBind()
after calling `GridView3.DataBind(), why do i still get Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index.
at this line of code GridView3.Columns(1).Visible = False yet the grid has rows and more than 2 columns. i found a thread about similar problem here [URL] Note that the Gridview columns have NOT been defined at design time.
i want to sort my Gridview rows by a template column that is not bound to any database field. This template coulmn just has a label whose text i set in code depending on a value in a different column that is databound. So am stuck on how to set its sortExpression since its not linked to an column.
i use a gridview to show data from datasource, but i have some column in this gridview that they're not bound. If i go in edit mode, my unbound control show me the textbox to enter value and its ok, but if i modify value thru rowdatabound, now when i go in edit mode, the textbox are not showing as i expect, its just showing the value i put in rowdatabound, but i don't have the textbox to let me enter a new value and update it after.
And more in the same relation: with the two above condition i wrote, when i dont modify value in rowdatabound, i can modify value in prerender event with this line:
TextBox box1 = this.GridView1.Rows[this.GridView1.EditIndex].FindControl("TextBox1") as TextBox; box1.Text = "a value" ; but
when again i modify value in rowdatabound, the line above will not work too, box1 is load with a null value
I have a gridview control bound to a sqldatasource in c#. In the rowdatabound event I look at a value in a cell and use a function to evaluate the value and depending on that value I populate an added unbound column in my bound datagrid to show an excalmation point. I now want to sort by the column with the excalmation point.
I'm try to add a combobox to my form which i have done and populate it with the infomation i need but i want to stop the user from being able to edit the first 5 character in the textbox part of the combo box( 1 is this possible 2 am i going about it in the right way).
I have 3 columns fro a db to enter ips ie 123.456.7.89 at the start if each number i want (SE1)(SE2)(SE3) which i can do at the momment . So I get in the combobox list 3 items with (SE1)123.456.7.89 OR just (SE1) depending of i a result is returned from the DB. However i don't want the user to be able to edit out the (SE?) part of the sting in the textbox. When editing i've tried used the text change event to try and capture the change and make sure the string.length > 5 , but the event does not fire also when i leave the combobox it it adds to the combox list. If I refersh it goes back to how it should be with only the 3 items.
I have a problem with CascadingDropDown... I have two related comboboxes, where the second is a slave of the first (e.g. country the first, cities the second). What I want is that if I select one country from combobox 1 then the second must be "filtered" by that selection (it should display all the cities inside the selected country, and the actual CascadingDropDown implementation is OK), but if I leave the combobox 1 in the default option (e.g. "Please select a country") I want the second to display all the cities I have in the database. The problem is that when selecting default option for combobox 1 the second combobox is disabled and a postback to my webservice never occurs.
it binding correctly(datasource dynamically binded) and it raises event too while changing index but it is not raising event when we manually clearing the combobox text..if currently combobox having text "ASP" then i manually select that entire text and using del key i am deleting but it is not raising event for me.. when i change index it automatically raising event...i need to raise event while combobox is empty...
how one might go about binding to a gridview in ASP.Net 4 in a scenario where the first row of my gridview should be the headers, the second should be a combobox for each column and the third is the beginning of my actual datasource.
If you can imagine what I am trying to achieve is an ability to create a binding between each column in the datagrid and another datasource. This binding is created by the user selecting a value in the comboboxes. However no matter what I try I cant seem to achieve this.
I am using an Active Directory DirectorySearcher to populate a DataTable and GridView so I can make a sort of "Phone List", very similar to the following post: [URL] What I also want to do is use a ComboBox with Append AutoComplete mode to easily filter this phonelist. However, what datasource am I supposed to bind the ComboBox to?
Is it possible that once I have created a datatable programatically, I can then sort that datatable before binding it to a asp:repeater? I have a number of records that I have to get from a com object that has not been eliminated. The com object populates an array, then I loop through the array to pull data from my datatbase, adding the db data to the datatable. Then I bind the datatable to a repeater.
1) the array is multidimensional 2) The COM object doesn't sort the data by company ID (which is what I need to do)
I have 2 tables, call them stock and visit. Stock contains a list of standard products (code and description columns). Visit contains a list of products used during a visit (product description column amongst others). When a user adds a product to the visit table they can either select a standard product from the list or select a product code and amend the description, e.g. they could select "paint" and change the description to "blue paint". The new description will only be relevant in the Visit table. This all works fine.
I have an editable gridview which lists the products used during a visit. There is an Ajax control toolkit combo box in the EditItemTemplate which allows the user to select a different product. If the product exists in the Stock list then everything works fine. If the user amended the description (e.g. changed "paint" to "blue paint" when they added the product to the Visit table I get the following error.
'ProductDescription' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value
I presume this is because the amended description won't exist in the standard list of products. How do I add the amended description to the combo box list? I've tried using the RowEditing event but can't reference the combo box in the EditItemTemplate.I think what I want is something along the lines of [Code]....
Combobox markup below
<asp:ComboBox ID="ProductDescription" runat="server" [code]...Answer in vb preferably.
I have an unbound dropdownlist that is populated in my page_load event. I want to retrieve the text of the selection from the dropdownlist. I'm
using dropdownlist.selectedvalue.tostring(), which works on original page_load but not when I make another selection, even though autopostback is set to true. Do i have to write something in the selectedindexchanged event when not databinding?
Reorder list control cannot be set to not postback? My hope for this control was that I could tie it to a list of data (either a datasource or even a manually created list) and then allow the user to move the items in the list up and down until they liked the new order of all of the elements. They then would click a button to save the updates to the database. Is this possible? It seems that after every reorder there is a postback requried to the datasource to perform an UPDATE, even if the PostBackOnReorder
="false" value is set.
So if my list is
1 Atlanta 2 Boston 3 Chicago 4 Denver 5 Edmonton
and they want to switch Denver with Boston and then hit the Update List button I could cycle through the list an only update two entries rather than all 5 entries twice (for each Postabk on reorder)
I'm new to DataGridViews. I have successfully created an unbound DataGridView that contains columns of string, numeric and date values, but I can't seem to figure out how to define a column as a numeric or date value--only strings. I have enabled sort on the columns so the user can click on any column to sort by that column. When I click on the numeric column, it sorts like:
12345.56 13.35 1442.22 ...
The dates also sort as strings rather than dates.What is the code to change the data type of an unbound DataGridView column? Is it possible? If not, how can I do this with my unbound data?