ADO.NET :: Add A Conditional Statement?

Nov 5, 2010

I use LINQ.But I can not add data twice "ZnizanaDnevnica.

How could you do one box:

tbl_dnevnice_obracun tbl_dnevnice_obracun = new tbl_dnevnice_obracun()

{ZnizanaDnevnica = ((totDiffHours> = 6 & & totDiffHours <8)? Convert.ToDecimal (dt.Rows [0] ['Znizana']. ToString ()): 0),((totDiffHours> = 12
& & totDiffHours <24)? Convert.ToDecimal (dt.Rows [0] ['Znizana']. ToString ()

View 1 Replies


Similar Messages:

Forms Data Controls :: Conditional In Gridview / Make Some Conditional Statement, When Value "key" Is Changed?

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

SQL Server Conditional Select Statement?

Feb 18, 2010

this might be an easy one, but I just can't get it.I am creating a page which will query a table with many columns and most items are not unique. I need to be able to get a list of records that match as many of the (up to 4) search criteria as possible.Example:am user searching for the following items, I enter at least one and up to 4 of the items below in a text box:Name, age, gender, weight (user may or may not fill in all of them).If he just enters "F" for gender, then he will get a list of thousands of females with their name, age, gender and weight.However if he enters "F" for gender and "300" for weight, he will get a much smaller list of returned records.I need to be able to create a sql statement that can perform that search with that functionality.

View 6 Replies

Web Forms :: Conditional Statement For Multiple Text Boxes?

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

Using #if Debug Conditional Compilation Statement In Aspx Page

Mar 9, 2010

I am trying to do something like this in an aspx page:

<head runat="server">
<% #if DEBUG %>
<script src="jquery-1.3.2.js" type="text/javascript"></script>
<% #else %>
<script src="jquery-1.3.2.min.js" type="text/javascript"></script>
<% #endif %>
</head>

I get an error "Preprocessor directives must appear as the first non-whitespace character on a line". How can I do this?

View 1 Replies

C# - Inline Script Conditional Statement Inside A ListView?

Dec 15, 2010

I'm trying to display an image inside a ListView control based on the value of a databound property. I've tried two methods of doing this (one at a time) and both returned errors of "The server tag is not well formed". Consider the code below.

<ItemTemplate>
<div class="left">
<!-- Method 1 -->
<img src="media-play-button.png" alt="Play" class="mediaplay noborder" runat="server" visible="<%# Eval("MediaType").ToString() == "video" %>" />
<!-- Method 2 -->.........

View 1 Replies

Forms Data Controls :: Conditional Eval Statement In Gridview?

Nov 18, 2010

I have a conditional Eval statement in a Gridview that returns a boolean result to display an image if two datafields(strings) are identical:

Visible='<%# Eval("customerA").Equals(Eval("customerB")) %>'

Works great except I don't want the image to display if both datafields are empty. How can I add that logic into this Eval stmt?

View 3 Replies

Forms Data Controls :: Populate Label Text With Conditional Statement?

Jun 29, 2010

I have a gridview with the following Template Field

<asp:TemplateField HeaderText="ADDRESS" SortExpression="CAST#">

View 14 Replies

Forms Data Controls :: How To Open New Window From Hyperlink Using Conditional Statement.

Dec 28, 2010

my code is :

[Code]....

row.item(6) field is a navigate url (asp:hyperlink) in front-end code as <eval('url')>

row.item(7) is a boolean field with values : true/false.

if row.item(7) is true then the hyperlink page must open on the current page.

whereas if row.item(7) is false then it should open in a new tab/window.

View 7 Replies

SQL Server :: (INSERT EXEC Statement Cannot Be Nested.) And (Cannot Use The ROLLBACK Statement Within An INSERT?

Sep 25, 2010

have a very important issue,i have three Stored Procedures Sp1,Sp2 and Sp3 .the first one (Sp1) will execute the second one (Sp2) and save returned data into @tempTB1 and the Second one will execute the third one (Sp3) and save data into @tempTB2.if I execute the Sp2 it will works and it will returned me all my data from the Sp3 ,but the problem is in the Sp1, when i execute it it will display this Error:INSERT EXEC statement cannot be nested I tried to change the place of execute Sp2 and it display me another error:Cannot use the ROLLBACK statement within an INSERT-EXEC statement.

View 4 Replies

C# - SQL Statement Transformed TO LINQ - How To Translate This Statement To A Working Linq

Mar 5, 2010

I am having trouble with this I have 3 Data tables i use over and over again which are cached I would like to write a LINQ statement which would do the following is this possible?

T-SQL VERSION:

SELECT P.[CID],P.[AID]
,B.[AID], B.[Data], B.[Status], B.[Language]
FROM MY_TABLE_1 P
JOIN
(
SELECT A.[AID], A.[Data], A.[Status], A.[Language] FROM MY_TABLE_2 A
UNION ALL
SELECT B.[AID], B.[Data], B.[Status], B.[Language] FROM MY_TABLE_3 B
) B on P.[AID] = B.[AID]
WHERE B.[Language] = 'EN' OR B.[Language] = 'ANY' AND B.STATUS = 1 AND B.[Language] = 'EN' OR B.[Language] = 'ANY' AND B.STATUS = 1

Then i would like it to create a result set of the following

Results:
|CID|AID|DATA|STATUS|LANGUAGE

View 3 Replies

Updatemode Conditional Malfunction

Dec 22, 2010

I've got a weird problem: On a page, i've 2 updatepanels in conditional updatemode, with childrenastrigger set to true (default value).

A click on a IPostBackEventHandler control inside either the first or second updatepanel causes the 2 updatepanels to refresh.

View 2 Replies

C# - Conditional Validation Does Not Work?

May 28, 2010

I have an ASP.NET web app (with C#). In it I have a form with several fields and validators. For one of the validators I only need to validate when:

a certain textbox is empty and a certain record does not exist in the database (this is already handled).

I know I can't enable/disable the validator on page_load because something might be entered into that textbox. I also tried the following in the onclick event of the submit button but it didn't seem to work:

Validator1.Enabled = true;
Validator1.Validate();

I also tried Page.Validate() but that didn't work either...

View 2 Replies

MVC :: Use Conditional Values In ActionLink

Aug 25, 2010

Is it possible to use a condition inside an actionlink ?I would like to do this :

[Code]....

This will be used for some column sorting and if the current sort was asc the next sort has to be desc. The code above is not valid while compiling.

View 3 Replies

Conditional Javascript In .ascx?

Jul 13, 2010

I have a javascript src that i need to add to some of the pages in a site.

for example <script type="text/javascript" src="http:abcxyz.com/zzz"></script>

I want to add this conditionally on a .ascx page - if the Request.ServerVariables["SCRIPT_NAME"] ends with certain criteria.

The ascx language is vb, and there is no code behind.

View 2 Replies

Looping Performance With Conditional C#?

Jan 6, 2011

Which of these will perform better if we assume that the IF block in #1 will be executed more and less in #2

foreach()
{
if
{
block here
}
}
or
foreach()
{
if !( )
continue
}

I've structured #2 to take the if conditional less often.

View 4 Replies

SQL Server :: Writing A Conditional T-sql In Vb.net?

Dec 23, 2010

How do I properly write an if statement for t-sql in vb.net?

I have this code:

[Code]....

View 3 Replies

C# - Conditional Statements Difference?

Feb 10, 2011

Is there any difference between below two statements

if (null != obj)

and

if (obj != null)

Edit: if both treated same which will be preferable?

View 7 Replies

DataSource Controls :: Conditional SQL Command In VB?

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

UpdatePanel Conditional Updatemode Not Working

Feb 9, 2011

I found this thread while trying to resolve my issue unfortunately this I can't seem to figure out the problem since I already have everything the way it should be.

I've got 3 updatepanels that each call a function on a .js file setup like this:

<asp:UpdatePanel ID="upPnlGeneralinfo" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<script type="text/javascript">
Sys.Application.add_load(BindPageLoad);
</script>

Each have a different ID of course. Whenever a control calls a postback within the update panel it works, however in the js file I added a console.log("running the js file") and I can see that it's being called three times meaning it's all three updatepanels are being refreshed instead of just the one.

All the triggers are inside each of the respective updatepanels so I shouldn't need to add any triggers (I did just to make sure and it makes no difference). Shouldn't the UpdateMode=Conditional resolve this?

Also worthy to mention, none of my code behind ever calls any updatepanel.update(). I tried adding that for each control to their respective panels and that also made no difference.

View 1 Replies

C# - How To Do Conditional Logic Within An .NET DataRepeater Control

Aug 12, 2010

I'm binding my DataRepeater control to a table that has many columns. I'd like to only display a subset of those, depending on what is populated.How/where should I do my contitional tests within a dataRepeater? This is the code within my itemtemplate:

View 1 Replies

MVC :: Conditional Partial View Rendering?

Nov 25, 2010

Just to get it work, I got a controller action that make use of a switch statement to decide which partial view to render, based on one of the members of the model passed in. (Written by someone else for what it matter...I'm just cleaning up)

The viewmodel is overcomplicated, but that's not my decision right now and just have to live with it.

All partial's get rendered passing the same viewmodel, just a different partial get called.

[Code]....

View 5 Replies

GridView Conditional Button Visibility?

Mar 28, 2011

I have this itemtemplate for a gridview column that is pulling data from a SQL database. My Question is how would I perform a check to see if my field ActivityFile has a value (which means a file is in the db) and then display the LinkButton at which point I generate code to download the file (already done and works).

<ItemTemplate>
<asp:LinkButton ID="DownloadFileBtn" runat="server" visible="false">Download File</asp:LinkButton>
<br />
<a href="<%# Eval("ActivityLink") %>"><asp:Label ID="Label4" runat="server" Text='<%# Bind("ActivityLink") %>'></asp:Label></a>
</ItemTemplate>

View 1 Replies

MVC :: Conditional Requirement Attribute For Model?

Jun 23, 2010

Is it possible to extend the RequiredAttribute class in a way to have it validate a condition against another property in the model? For example, in my hypothetical code.

[Code]....

The DriversLicenseProperty is to be required in the model if HasLicense is true. Is this possible? Is there an example somewhere?

View 1 Replies

Conditional Required Attribute For Validation?

Mar 23, 2010

We're trying to get a conditional attribute to work, case in point, there's a boolean (checkbox) that if checked, its related text is required. So, ideally we'd have something like ...

public bool Provision { get; set; }

[ConditionalRequirement(IsNeededWhenTrue = Provision)]
public string ProvisionText { get; set; }

Is this even possible?

Alternate idea (not as elegant?)
public bool Provision2 { get; set; }
[PropertyRequired(RequiredBooleanPropertyName = "Provision2")]
public string Provision2Text { get; set; }

I'd hate to use the magic string method .

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved