DataSource Controls :: Conditional Multiple Evals?
Jun 16, 2010
I am stuck with conditional multiple eval declaration of navigateurl property of hyperlinkI want to bind the navigate url property depend on user selection and set its visible property based on NULL value in SQL databse at the same timeThe code that i have at the moment :
<asp:Hyperlink ID="Hyperlink1" runat"server" NavigateURL='<%#Eval("link1") %' Visible='<%#ISNull(databinder.eval(container.DataItem, "link1"))%>' </asp:HyperLink>
In the code behind i run function ISNull, which works fine returning either true or false depend on value, however it only works for single EvalI believe that i am looking for function code behind that returns the value of Eval, so if user selects Product1 i want link1 to be bound to navigateurl and set its visible property if link isnot null in database but if user selects Product2 or Product3 then i want the same hyperlink to display link2 or link3, set its visibility again based on null values from ISNull function
View 3 Replies
Similar Messages:
Jan 3, 2010
I want to know how I could fix the following. I essentially have two almost identical SQL functions and want to combine them into one. The only difference between the two functions is the SQL Command text that is being used. Here is a brief idea of what I have unsuccessfully tried thus far:
[Code]....
I receive no compilation errors, but the exception is thrown and table is not filled. I have a feeling that I am overlooking something obvious.
View 3 Replies
Sep 22, 2010
I'm trying to find a way to do the following psudo:
void foo(int iArea, int iCity)
{
using (myDataContext context = new myDateContext)
{
var query =
from ad in context.Ads
join publisher in cintext.Publishers on ad.PublisherID equals publisher.ID
select new
[code]...
I can't find a way to do the check if the area code(iArea) is contained iside the string of the adArea from the DB.
View 3 Replies
Feb 25, 2010
This might be confusing but ill try to explain the best as i can. I have a gridview that get the data from datatable. This is simulation my grid view.
key data
1 data1
2 data2
2. data2
2. data2
3. data3
3. data3
what i want is make some conditional statement, when value "key" is changed i want to add empty row. so its suppose to be looks like this as result.
key data
1 data1
EMPTY ROW
2 data2
2. data2
2. data2
EMPTY ROW
3. data3
3. data3
View 2 Replies
Nov 7, 2010
I have 50 textboxes in a table and i would like to write a conditonal statement. If the textboxes has null or empty then i want to assign them 0 to all the textboxes.(VB.Net) I tried
[Code]....
View 4 Replies
Mar 7, 2011
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:
[Code]....
View 2 Replies
Jun 4, 2010
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.
View 1 Replies
Dec 1, 2010
I have 2 UpdatePanels in the same Page, and each one contains a GridView with some datta. I am using UpdateMode="conditional" because i only want the GridViews to be Filled when needed. So the data in each GridView is loaded only if the user asks for it, and it's not loaded again unless you need a change in the grid (sorting or page changing).
GridViews are filled with data from a DataBase, but I only read the data from the Database when needed. So, in first Page_Load, any data is readed. If the user wants to see the data in GridView1, the data in GridView2 is not loaded from the database, and viceversa.
My problem comes in this situation:
User enters the Page.
User ask for the data in GridView1 (UpdatePanel1 does the job)
User ask for the data in GridView2 (UpdatePanel2 does the job)
Now, the user can see both gridviews in the page. If he tries to change the page index or to sort data in GridView2, everything goes fine. The problem comes when he tries to change the page (or sort) in GridView1 (because in the callback to retrieve the data to GridView2, GridView1 was not filled, so the data the user is seeing is there because of a previous callback). The user gets an Event Validation Exception, and i don't know how to avoid it. I think it's because the server "thinks" that GridView1 is empty, because of the callback to load data to GridView2, where GridView1 was not filled.
View 8 Replies
Mar 23, 2011
I am trying to program the where prameters for this in code behind in C#, and is there really no way to do more than one parameter? Or am I not understanding this correctly? It seems only the 2nd parameter gets executed, no matter which one is at begining. I debug and seems they both get executed fine, but my listview doesn't get filtered and instead only the 2nd paramter works. Look at my code:
Also, if I do myLinq.Where = "division ==1 and someotherInt = 2", it works fine, but if I do two different data types, it will throw error. Since I want to filter with two different data types, hwo do I do this?
Parameter pram1 = new Parameter();
pram1.Name = "division";
pram1.DbType = DbType.Int32;
[code]...
View 20 Replies
Sep 4, 2010
I'm having a question about the LinqDataSource. Does anyone know if it's possible to perform multiple inserts with the LinqDataSource? Let's say for example that I have 2 tables.
Table A
AID = PK autoincrement Name AddressA FK AddressB FK
Table B
BID = PK autoincrementStreetNumberPostalCodeCountry
These tables are just examples to clarify my question. Let's say that I have a FormView with a LinqDataSource where the user can enter his name en a billing address (A) en delivery address (B). Now I would like to know if the LinqDataSource is able to insert 2 records in table B and use these ID's to insert them in table A together with the name?
View 2 Replies
Jun 8, 2010
i want to know how to connect to multiple databases in sql from our asp.net code??
View 4 Replies
Mar 9, 2010
is there a SQL statment i could write that would sum each column and allow me to then access each sum individually
i.e
Dim objCmd As New OleDb.OleDbCommand("SELECT SUM(expression) FROM orderForm WHERE OrderDate=@OrderDate", objConn)
is there anything i can replace expression with such that all the columns in orderForm could be summed and returned as one record
or is there a way to replace expression with something that would allow me to just keep changing the paramater so i could continuously reexectute the same command w/o having to create a new command for each column
View 2 Replies
Jan 24, 2010
I have field_1, the data format store in the field is about "Mary, Amy, Billy, Ma"
how can i extract the record that the field_1 has Mary.
I can't use the like'%Mary%' because it can extract 'Ma' too.
I would like to extract exactly Mary. or can i split the field_1 by ',' in sql?
View 6 Replies
Jan 20, 2010
I am currently trying to create a SQL statement that does a multiple count on a table. The table has a number of reports each listing the "User" who created that report and if that report is "Famous" (A famous report is symbolised as 2 in the table).
What I need to create is a SQL statement that returns each User with the total number of reports he/she has created and how many of these reports are famous. My current SQL statement looks like:
[Code]....
View 4 Replies
Feb 6, 2010
I am creating an online employment application, and instead of creating a table with 20 columns for job duties that may or may not receive values, I simply want to create 3 columns
ApplicantID
EmployerName (Name of Work history Employer)
JobDuty
I want to create a form on a page with 10 textboxes so the applicant can type in some job duties they had at that job.
Is there a way in C# or SQL to then cycle through and insert the textbox values as separate rows?
View 4 Replies
Aug 3, 2010
i have a table containing multiple agents , another three containing events ( three types of events , each category in a diffrernt table) organised by each agents! , i have to figure out how to fill a grid view that regroups a summary of the activity of every agent ! for example :
AGENT EVENT1 EVENT2 EVENT3
agent1 3 0 2 agent2 4 4 1
agent3 5 4 2
that means that the agent 1 have organised 3 EVENT1 0 EVENT2 and 2 EVENT3 ....
i have used the count(*) clause to fgure out the number of rows in table events referencing to each agent (group by) but it seems that value 0 is not returned by the clause , so i'm having a problem getting the exact values!
secondal , i have putted two calendar that will fix the beginnig and the end of the summary , but it seems that the end day is not included : it says 18/01/2010 00:00:00 and i have some events planned in 18/10/2010 14:10:00 so they are not counted !
View 4 Replies
Apr 22, 2010
We have about 500 scripts that we are modifying at development server . These modified scripts have to be run at the live server .
Well instead of running each script, we are thinking of a platform independent application (If we develop in dotnet the user(DBA) has to have dotnet framework installed,hence i am not thinking of a dotnet application) which will execute the script.
(These scripts will be enclosed in a folder and sent to DBA. Through the newly developed application the DBA should be able to browse this folder and on clicking a particular button the scripts placed inside the folder should run.)
Basically such an application should be able to connect to the database and run the scripts that we saved in the folder....
View 4 Replies
Oct 4, 2010
I want to pass to a DataSource(SQL, Linq) more than one SelectParameter or what ever will do the work.I have many ArtistIds i want to pass to my source, so that it will display only those entries with my Parameters.My Problem is, that i dont know in which Format i can pass more than one Parameter, till now i used QueryStrings but that only works for one Parameter, no? I have a DataTable filled with all my IDs and im system-caching it to pass it from a Search-Site to a Detail-Site, maybe theres a better way?
This is my Source:
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:MvcMusicStoreConnectionString %>"
SelectCommand="SELECT Album.Title, Album.Price, Album.AlbumArtUrl, Artist.Name, Genre.Name AS Expr1 FROM Album INNER JOIN Artist ON [code]...
View 1 Replies
Apr 8, 2010
Ok I hope I can describe this clearly. This is all demo code nothing in production.Right now I have a stored procedure that is
[Code]....
This will return only one row as ID is uniquethen I have a procedure that gets all the colors that are available for this model number and i use that data in a drop down list, it is like this
[Code]....
this can return multiple rows with different colors.Right now i am opening a connection getting the product data, consuming that to properties of a class, then to get the data from the Colors I open another connection run the procedure with the model parameter being the model returned from the first sproc and bind that to my ddl.I want to do this in one connection and just get two result sets back. So how do I set the parameter of the second procedure to be the model from the first?
View 8 Replies
Jun 4, 2010
I am using 3 web controls ,two are cascading dropdownlists used to filter gridview control bound to a datasource.
My question is , How to define multiple queries in stored procedure that takes parameter values from the controls declared using sqldatasource.Also, return all data when i set default control value to say 'null'.
NB: one paramaterised query for cascading dropdownlists and another for other control.
View 8 Replies
Mar 4, 2010
I have a query regarding asp.net validators. I want to conditionally skip asp.net validators and allow/disallow form submission based on a checkbox for skipping validations. I tried a few things but I am facing some problems. Please see the code snippets below to get an idea of the requirement.
View 3 Replies
Jun 1, 2010
the best way to achieve the following:A products table linked to an images table where 1 product can have many images.Simple scenario is to select a product and its images using
select * from products where id=5
select * from images where pid =5
So far so good, its easily mapped to an object once the query has executed with ado.net.
what if i want to select all products and their related images and map them to a Product object, the result is as follows
SELECT * FROM PRODUCTS JOIN IMAGES ON ID=PID
Now the table I get is:
ID PRODUCTNAME IMAGEURL
1 COMPUTER IMAGE1.JPG
2 COMPUTER IMAGE2.JPG
3 COMPUTER IMAGE3.JPG
I would need to do some work in c# to keep track of id and get images until the id changes, if you get what I mean.
I want a way that I can execute a single query like the one above, or modifed version and make it easier to map the result to my objects.
Something like,loop products,map products to product object,loop images map images to products.images
View 8 Replies
Mar 4, 2010
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
View 2 Replies
Jan 11, 2010
I have a sproc that will insert a new record into Table1. Next I need to Insert into another table the scope_identity of the inserted record. How do I incorporate the scope_identity value as the insert parameter in the second insert statement?
View 3 Replies
May 18, 2010
How do I select multiple columns into IQueryable<Employee>?
View 2 Replies