Tagged Questions

1
vote
0answers
45 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
86 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
133 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 ...
0
votes
3answers
2k views

change select command of sql data source at runtime

HTML <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="id" DataSourceID="SqlDataSource1"> <Columns> <asp:BoundField DataField="id" ...
0
votes
0answers
211 views

Programmatically Execute Sql Datasource with OnSelecting event from Codebehind

I need execute a sql command with onselecting events in c#. With this code below, it is not firing selecting events. Any help? Here is my code: SqlDataSource sqlSource = new ...
2
votes
1answer
5k 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
358 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
550 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 ...
0
votes
1answer
505 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
70 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
224 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
240 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
10k 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
4k 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 ...
1
vote
1answer
531 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 ...
2
votes
1answer
768 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
111 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 ...
3
votes
2answers
9k 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 ...
1
vote
1answer
675 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
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
0answers
529 views

SqlDataSource manual Update how to?

I'm looking for a solution how to manualy call 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 happens. ...
0
votes
2answers
176 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
200 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 ...
0
votes
1answer
3k 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
3k 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
93 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 ...