Forms Data Controls :: Multiple Repeaters Using The Same DataSource?
Jan 26, 2010
First, I'm needing to report info from a database (currently an Access database that will be migrated to a SQL database shortly). There are too many fields in the database to just let them go on and on across the page. I've got the first repeater working GREAT! but none of the other repeaters populate at all.
I have 3 nested repeaters and in my code behind I can't seem to lock onto the second level repeater. I have written code for the third level but I will once I figure out how to get to the second level. My code is written below.
I have a table with articles. Every article has a column named category which value is either 1 or 2 On my landingpage the article headers are displayed as hyperlinks. All the articles with category 1 will be displayed in a repeater control on the left side of page and all the articles with category 2 will be displayed in another repeater control on right side of page. I know I can bind the repeaters to two different sqldatasource controls with different SELECT statements. But I wonder if I can do this by only using one sqldatasource control, and if this is better and proper way of doing it. If so, do I create a (datatable?) and do the sorting there?
I use if(! Page.postback) to fill those two repeaters I want to get the data related to checked checkboxes when using the below code it get only the data of the first checked box how to make it brign all the data
private void Btn_Confirm_Click(object sender, System.EventArgs e) { //CheckBox checkedButton = null; foreach (RepeaterItem item in ParentRepeater.Items) { CheckBox control=(CheckBox)item.FindControl("CheckBox1"); if (control.Checked) { //checkedButton = control; foreach(DataRow r in GetInnerData(control.Text).Rows ) // GetInnerData is used to pring datarelated to the selected check box { if(r["DESCRIPTION"].ToString() == control.Text) { Response.Write(r["DESCRIPTION"].ToString() + r["Date" ].ToString() + r[ "Trx" ].ToString() + r[ "GL" ].ToString() + r["Amount" ].ToString() +" "); } } control.Dispose(); //checkedButton.Dispose(); break; } } } }
I am having trouble getting the following code to display side by side in a table. At the moment it displays next to each other in different cells but the cell on the right stretches further down than i would like, the opening item in the cell - <%#Eval("Product_ID") %> - is level with the end of the image in the cell on the left and everything else continues on new lines below it, when what i was hoping would happen would be for the product id to be directly across from the top of the image and the rest of the items to go below that. I have tried datalists and detailsview but they do not give me what i want either
I have several repeaters on the same page. They are not nested. Because of design and database issues I had to keep them independent. I need to total the amount in a particular column for all repeaters. Is there a common approach to this or do I have to hack something?
I have four repeaters, that are all independent to each other. They all bind via web services on page load and then display the results.
There is a noticeable delay however and I would like to know how to achieve the following if possible.
On page load I want to begin asynchronously binding the repeaters so that as soon as the first one is bound, its result display and then the next starts binding.
I looked at update panels but from what I have read they do not have a page load trigger.
For the solution, I cannot use any event handling methods, because my webapp is fully ajax based and no complete postback is possible. So here's the problem.I have a `List<WebPage>` that contains a list of Links `(List<Link>)` and I need for all the links to bind repetitive information such as page title, id, url. Here is my current repeater.
Would it be better to have a sp return multiple result sets and use NextResult() or have subsequent call to dr.execute.... () and hadle one result at a time?
To me using nextResult() on a multiresult datareader would be cleaner and easier - but it does not seem to be very "atomized". I guess I am wondering can the cost of executing multiple commands be neglected? Seems like executing multiple commands and receiving a single result set would also be easier to read/test/understand.
I have a parent repeater that lists the sections of the website. this repeater binds to display a table that contain another repeater of the website pages .. or may display a table that contains another two repeaters of the projects categories and sub-categories.Until now everything is going fine.
The problem comes when I try to include a query of the section ID to the link of the project categories (DataView of the projects repeaters does not contain SectionID)my question is : is there any way to call the SectionID of the first repeater in my projects categories and sub-categories repeaters?Here is my code:
I have one repeater control with check boxes in one of the page.My requirement is i have to pass the values of the row that i have checked (multiple check boxes can be selected at a time) when i click on a add button in the same page which is placed outside the repeater control.and, i want the details of the rows that i have selected to populate in another repeater control placed in a different page. how to do this using query string??
how to show two asp:repeater side by side with same functionality.I have tried have copied same code with different method names but am not getting it only ten records by default its showing for second repeater and first repeater works well.
I tried to find out about subject but with no success. The point is that in the beginning I've made many user controls. My site is too slow. I have not idea yet if it is because of user controls.
I have two tables - dt(Mods) and dt(Mods2) - I am trying to create a relationship between them. So dt(mods) has department, category and item columns dt(mods2) has parentDept, Parentcategory and parentItems Now I need add them to a dataset with a relationship key - Something like this but with three cloumns
Dim ParentCol As New DataColumn, ChildCol As New DataColumn
I have hard time trying to find the solution to retrieve data from multiple tables in one database.
table Kategorije has fields: idKategorija, naziv, opis table Clanak has fields: idClanak, idKategorija, naslov, autor,...
Kategorije.idKategorijais joined with Clanak.idKategorija, but that isn't the solution because I want my web site to show the Kategorije.naziv instead of Kategorije.idKategorija. This is the code I'm currently using to get idKategorije shown on my web site:
I need to export data to multiple worksheets based on some conditions. Currently i am able to export the data to a single sheet in excel using below code,
I am trying to design my logic to do this but I want to create a dataSet which will have records from several databases, The records all have the same layout.
I am reagin the connection string paths from a table in a database.
I am asking for your help in trying figure out my logic.
Should I use the connectionString builder in conjunction with a loop to Connect, read a record into a dataset Until therer are no more records to be read from my databse table with the database name/paths tables ?
Here is my beginning code which deals with one database:
I am writting a directory website that advertises fitness classes. These classes are listed by Class Type, and Geographical Area. Each Class Type can satisfy one or more of four Fitness Goals such as Loose Weight etc...
I have a table for Classes (classid, classname, classdesc, classtypeid, geoareaid) I have a table for geographic areas (geoareaid, geoarea) And I have a table for ClassTypes (classtypeid, classtypename, classtypedesc)
Which obviously links geographic area via the classes.geoareaid as a forgien key and classtypes by classes.classtypeid as a forgien key.
I can list all classes by type and also by geo area no problem, the problem arrises when I then also want to filter by goal.
The Goals Table (goalid, goal, goaldesc) is linked to the classtypes table via another table classtypes_goals (classtypeid, goalid) as each classtype can satisfy any of the 4 goals.
I am using a DataSet to fetch the data from a Stored Procedure in the SQL Database but because the classtypes can be linked to multiple goals I am getting duplication in my list depending on how many goals a classtype satisfies.
All I need in my data list is class name, class type and area I don't even need to display the goal I just want a drop down above the table that will filter the list and show only classes of classtype that satisfy the goal chosen.
I'm looking for ideas on deleting data from the multiple SQL tables with LINQ (C#).
My existing solution does the following:
1. DeleteAllOnSubmit( Subset of the data from the child table)
2. DeleteAllOnSubmit( Subset of the data from another child table)
3. DeleteAllOnSubmit( Data from the parent table)
4. CommitChanges()
All this resides within a single method, which makes it ugly and not re-usable.
I have considered the following alternatives, but I decided not to use them:
1. Cascade delete on the tables.
2. Do a join on all tables from which I will remove the data, but I'm not sure yet whether I could pass a join query to DeleteAllOnSubmit().
3. Write stored procedure(s) to delete data from each table. I don't have the time to implement this due to a large number of tables and the time constraints.
Im struggling with a way to bind multiple rows of sql data to specific controls, what im trying to acheive is having a list of questions / answers in my SQL db and loading them into my web form to build a questionaire.
The data i load into the form depends on criteria like which questionaire is it (there will be 2 seperate ones) and what language should it be loaded in, this will be controlled using drop down lists and passing these parameters to the SQL select statement.
The problem i have is i am unsure which method to pull the data out of the question column in my table, and bind it to seperate controls row by row, should i use a SQLDataReader or load the data into a dataset, or run a stored procedure to pull the data?
Which is the best way to get data from sql and bind it to controls in this situation?