2
votes
5answers
10k 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" ...
0
votes
0answers
601 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 ...
4
votes
4answers
21k 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 ...
2
votes
2answers
1k 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 ...
1
vote
4answers
15k 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
6k 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
721 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
153 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 ...
0
votes
2answers
1k 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 ...
0
votes
1answer
368 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.
0
votes
1answer
346 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
238 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
201 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 ...
1
vote
2answers
8k 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 ...
0
votes
1answer
202 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 ...
4
votes
1answer
2k 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 ...
3
votes
1answer
12k 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
667 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 ...
0
votes
1answer
2k views

Inserting data into a database table via SqlDataSource ASP.NET

Good afternoon, 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 ...
1
vote
1answer
122 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
2answers
243 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 ...
1
vote
1answer
967 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 ...
0
votes
0answers
367 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 ...
0
votes
2answers
422 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
19k 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 ...
0
votes
1answer
134 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 ...
1
vote
1answer
849 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
1answer
4k 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, ...
0
votes
2answers
1k 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
2answers
223 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
2answers
4k 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
95 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 ...