Tagged Questions
0
votes
1answer
33 views
2 Dropdownlists in Gridview cause error: Databinding methods such as Bind() can only be used in the context of a databound control
Though this seems to be discussed before, I can't apply given help in my case:
I have 2 DropDownLists (DDL1, DDL2) inside the Edit Template of a Gridview, which is bound to a SQLDataSource. DDL2 ...
0
votes
2answers
93 views
SqlDataSource not binding with multiple parameters
I have a very simple ASP.NET page that has two textboxes, a button, a SqlDataSource and a GridView. The SqlDataSource gets it's two parameters from the two textboxes, which it then passes on to a ...
0
votes
1answer
58 views
Separate GridView column in two with condition
I have a GridView and only SqlDataSource. In my table I have 2 types of data stored in a column. First - distribution of books in our university and second - to other branchs.
I need to separate one ...
3
votes
3answers
11k views
'DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value
I'm using TemplateField in GridView to implement edit/delete from database.
I'm Querying Data with the SqlDataSource Control.
when I edit the Table from page I get following error:
'...
0
votes
1answer
1k views
how to get all data from GridView before the paging occurs
I have GridView that have a SqlDataSource as DataSource. The GridView has its PageSize property set to 10 and AllowPaging to true. What I am trying to achieve is to get all rows data from the ...
0
votes
2answers
1k views
Gridview: editing after searching
MY search button is linked to a GridvieW, which has an edit button on every row. When I press search button, data changes and a databind() occurs.
After that, If I try to use the edit button it ...
0
votes
2answers
245 views
Is this the correct way to bind a textbox to a gridview?
I was trying to use a textbox as filter for a gridview and ended up writing this code:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
...
2
votes
2answers
3k views
Does a Sql Datasource run a select query on load if no contol binds is bound to it?
How can I configure a gridview and datasource on a page to only execute the query if the user clicks a button?
The datasource will return over 1 million records and the page will be accessed by a lot ...
0
votes
1answer
834 views
Adding rows to a Gridview that is bound to a SqlDataSource
I am trying to add a row to a gridview dynamically, while the gridview has a SqlDataSource bound to it. Is it possible to add a custom row while the data is still binding? I am coding in vb.
5
votes
5answers
74k views
How to clear exisiting dropdownlist items when its content changes?
ddl2 populates based on ddl1 selected value successfully.
My issue is the data that is already present in ddl2 does not clear before appending the new data so ddl2 content just continues to grow ...
1
vote
1answer
10k views
SqlDataSource with DropDownList Control Parameter doesn't read value
I have a drop down list that bound to a SqlDataSource.
I have another drop down list that's bound to a different SqlDataSource.
The second SqlDataSource has the first drop down as a Control ...
0
votes
1answer
453 views
ASP.net/VB.net Generating a data bound form at runtime
I'm currently trying to put together code that will dynamically generate a set of HTML form controls at runtime, and then databind those controls. From what I've read, you can't databind form controls ...
1
vote
0answers
437 views
nested repeater each with sqldatasource
<asp:HiddenField ID="hfOrderState" Value="1" runat="server" />
<asp:SqlDataSource ID="ReadyOrders" runat="server" EnableCaching="true"
DataSourceMode="DataSet" ...
0
votes
1answer
275 views
Does using sqldatasource with gridview work the same as setting datasource and databind() in page's init?
I have never used any of the datasource objects in my aspx pages. I set the datasource for a gridview and databind() in the page's code behind. I am looking at some samples which use a sqldatasource ...
0
votes
1answer
222 views
Is it possible to have a SQLDataSource with a parameter that is based only upon the GridView that is binding to it?
I have a scenario where I want to put four identical Gridviews on the same page. (They will be on different tabs in an Ajax TabControl.) They show the same source data, but there are four ...
3
votes
5answers
22k views
Change select command of sqldatasource at runtime
HTML
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="id" DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="id" ...
3
votes
1answer
16k views
The GridView 'GridView1' fired event Sorting which wasn't handled
I have created a gridview using toolbox in c#,
it is able to show & sort the items in my sqldatasource, but when I change the sqldatasource as it can be seen in the below code, it displays the ...
0
votes
2answers
878 views
Error in binding SqlDataSource data to GridView
I am getting this error:
Databinding methods such as Eval(), XPath(), and Bind() can only be
used in the context of a databound control.
I am trying to bind SqlDataSource's results to a GridView....
0
votes
1answer
4k views
Inserting data into a database table via SqlDataSource
Recently I have been watching Plural Sight ASP.NET videos on data binding, and I came across declarative data source controls such as <asp:SqlDataSource />.
I am having trouble understanding ...
0
votes
2answers
2k views
PostBack DataBind error: “Ensure that the control is added to the page before calling DataBind.”
I have a program that allows the user to use a few dropdowns to pick a topic and attribute, then the data are pulled that match on both of those conditions. In the gridview are a lot of ...
1
vote
1answer
147 views
Adding Datasource object as property
I have two problems:
I am creating a WebControl and I like to add SqlDataSource as its property. It doesn't matter under what is the property name, Visual Studio shows its name as Database. Following ...
0
votes
0answers
386 views
Empty DropDownList with use of Select Parameter
I'm having trouble passing DataBound label text to a SQLDataSource. The consuming dropdownlist, the label with the parameter, and the SQLDatasource are all within a GridView EditTemplate. The DDL is ...
1
vote
2answers
814 views
How do you DataBind a SqlDataSource to a DetailView in a UserControl?
I have a user control I have created that contains a details-view that I plan to use as a template to develop many other pages using. For example, I want to use this control on another .aspx page I ...
1
vote
2answers
22k views
Binding DropDownList SelectedValue to DataValueField for GridView Update
Ok guys, so I read this:
How to set SelectedValue of DropDownList in GridView EditTemplate
and I'm having the same issue. However, I don't want to bind the selected value to the displayed text, but ...
1
vote
2answers
11k views
bind sqldatasource result to textbox c#
I have a SqlDataSource that returns 1 field (1 row) for an ID. I would like to get that result and display it in a TextBox. I would normally do it using a stored procedure (since the stored procedure ...
2
votes
1answer
1k views
Modify sqldatasource selected data before binding?
how can i access the my sqldatasource selected datasource for modification and adding for example new datacolumns before binding??
where is the best place to perform these modifications ?
I guess ...
4
votes
1answer
4k views
Adding ControlParameter to SqlDataSource prevents query and databinding?
I have a SqlDataSource that calls a stored procedure and it works fine. If I add a <ControlParameter> tag to add an additional argument, then the query never fires and the databinding never ...
0
votes
1answer
137 views
Advanced manipulation on automatic data binding in .NET, architectural problem
I have application with following data flow:
SqlDatabase -> SqlDataAdapter + SqlCommandBuilder -> DataSet -> DataGridView
All conversions and bindings are automatic.
This is all simple and ...
8
votes
4answers
44k views
How to set SelectedValue of DropDownList in GridView EditTemplate
I am trying to do this as asked earlier. The only difference that I found is additional List item that was included in above code.
I tried to use AppendDataBoundItems=true but it is still not working....
1
vote
1answer
1k views
How to use SqlDataSource for filling combobox as well as datatable or Dataset
I am trying to fetch a column value from a datasource when some value is selected from a dropdownlist on its change event.
<asp:DropDownList ID="ddlCityName" runat="server" DataSourceID="dsCity"
...
0
votes
2answers
2k views
How should I set an asp.net label's text to some value in another control?
I'd like to set the text of two labels to values found in a FormView on a page (whose data comes from an SQLDataSource.)
What's the best way to do this? I'm thinking of using the DataBound event for ...
0
votes
0answers
666 views
How do I manually call the Update method on a SqlDataSource?
I'm looking for a solution on how to manually call the Update method on a SqlDataSource connected to a DetailsView. The problem is that if I call the Update method from a button.onclick event nothing ...
0
votes
2answers
296 views
How can I see the actual SQL an ASP SqlDataSource will run (after binding)
This is a very simple question, but one I can't find an answer to. If I have an SqlDataSource that takes parameters, how can I see the actual SQL that will be executed against the DB after the binding ...
0
votes
2answers
230 views
Do not fill DropDownList if upstanding UserControl isn't visible
I have page Add.aspx containing a number of UserControls: AddRequest.ascx, AddOperation.ascx, AddObject.ascx, etc. Depending on Request["type"] one control becomes visible.
Each UserControl contains ...
1
vote
1answer
5k views
If DataBind() is called inside Page_Load(), then SqlDataSource doesn’t perform updates
If I bind GridView (via DataSourceID attribute) to SqlDataSource and set SelectCommand and UpdateCommand attributes, then everything works perfectly.
But I’ve noticed that if I, for whatever reason, ...
2
votes
2answers
5k views
How to add Item to SqlDataSource databound list
I am lazy - and I am using a SQLDataSource to populate my dropdownLists.
The Databind event for the databound objects is called before the Page.PreRender so I am doing something like this in the ...
2
votes
2answers
101 views
Does anyone know a way to “share” a datasource without causing multiple postbacks?
For instance, I have a SqlDataSource that loads a list of items. On my form, I've got 3 dropdown boxes that both should contain that same list of values, and then the user can select a different ...