# Data Controls :: Calculate Textbox Value Based On If Condition Inside Stored Procedure

Jul 17, 2015

I have 3 Textboxes in my Web page. When user key in value in these 3 textboxes,their result should show on a "Label"

1) Gross Amount
2) Taxable Amount
3) Tax Amount

I have to write a Stored Procedure for calculating the value of above textboxes.

Condition is:

If Gross Amount is > or < 0.00, then Taxable and Tax amount should calculate based on below formula:
@TaxableAmt = @GrossAmt / @Rate
@TaxAmt = @GrossAmt - @TaxableAmt

but If Taxable Aount is > or < 0.00, then Gross and Tax amount should calculate based on below forumla:

@GrossAmt = @TaxableAmt * @Rate
@TaxAmt = @GrossAmt - @TaxableAmt

and for "Tax Amount" I have 2 different conditions:

If Tax Amount is = 0.00, then Taxable and Gross amount should calculate based on below formula:
@TaxableAmt = @TaxAmt / (@Rate-1)
@GrossAmt = @TaxAmt + @TaxableAmt

but If Tax Amout is <> 0.00, then whatever the value of Tax Amount is, it should key-in/show as it is.

i.e., @TaxAmt = @TaxAmt

For this requirement, I wrote below SP:

ALTER PROCEDURE [Invoice].[usp_tbl_TaxCode_Update]
-- Add the parameters for the stored procedure here
@TaxCodeID nvarchar(50) ,
@GrossAmt decimal(18, 2),
@TaxableAmt decimal(18, 2),
@TaxAmt decimal(18, 2)

[code]...

But its not working as per required.

Similar Messages:

## Data Controls :: Change Value Of Label Inside GridView Based On Condition

Jan 14, 2014

How to change the value of a "label control in cell of a gridview" from codebehind (no matter whatever data is there in database).I am fetching 4 columns from databse in "label control in cell of a gridview". I want to change the value of a particular column from code behind (no matter whatever data is there in database)

i.e.,

If ( value == '2')display 2 columns value in label control in cell of a gridview from databaseand display other 2 columns value in label control in cell of a gridview as "Not Applicable".

If ( value == '3')display 3 columns value in label control in cell of a gridview from databaseand display other 1 columns value in label control in cell of a gridview as "Not Applicable".

How To Hide A Column But Still Retrieve Its Values? How To Access A Label Control In Cell Of Gridview

## Data Controls :: Change Color Of Label Control Inside GridView Based On Some Condition

May 7, 2015

I am trying to figure out a way to change the color of the text display in a label control or span inside a user control. The text needs to be displayed in a different colour based on the value returned.

<asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name").ToString()=="Flying Bats" ? "Display the text in green" : "Display the text in red" %> '/>

The text value would be one of the two. The font color needs to be ether red or green based on whats been returned.I cannot figure out how to do it.

## Data Controls :: Disable TextBox In GridView Based On Some Condition Using JavaScript?

May 7, 2015

i have a Q on JS...

I have a page1 send value to hidden field in page2..

so.. how can i create a function , using the hidden value to check value that same with the hidden value in gridview and make textbox in gridview readonly false?

## DataSource Controls :: How To Calculate Current Financial Year Using Stored Procedure

Mar 6, 2010

I want to calculate the current financial year in my stored procedure and use it when generating a unique Id for the customer registring in my system.

## Data Controls :: Hide Shown Items In GridView Based On Stored Procedure?

Mar 11, 2013

I have 2 page admin.aspx page  and search.aspx

in admin .aspx page I have textbox=txtsearch and image button=imgs

in txtsearch we can type Mobile Or phoneNumber and when we click on Imgs we go to search.aspx page

below are code

protected void imgs_Click(object sender, ImageClickEventArgs e)
{
}

in search.aspx page I have gridview that bind from database and show data according to Mobile or PhoneNumber that I typed in txtsearch in admin.aspx below are code

<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" CssClass="DGridViewSV"
AutoGenerateColumns = "false" Font-Names = "Tahoma"
Font-Size = "9pt"

[Code].....

Now I want when I enter Mobile in txtsearxh and click button when it go to search.aspx page it in grid view it show Mobile number in HLcalss from database and it doesn't show PhoneNumber and Code in Hyperlink1 and lblCode

and if I type phoneNumber in txtsearch in gridview it showes PhoneNumber and Code and it doesn't Show Mobile number

## Stored Procedure Which Runs On 5000 Users In Tbluser Table With Some Filter Condition In Database?

Mar 7, 2011

I have created one stored procedure which runs on 5000 users in tbluser table with some filter condition in database.There are 4 filtering condition(FC1,FC2,FC3,FC4).Filtering condition has some ListBox and dropdown list of department and countries.I want output as given below:

ID Name StaffNo department Points
1 KK 111 dep1 2
2 NN 222 dep2 1
3 DD 333 dep3 4

I got ID,Name,StaffNo,department in resultset but not points.

points calculation would be based on filtering condition like

if FC1 matched user gained point 1,if both FC1 and FC2 matched user gained 2 point,if both FC1 ,FC2 and FC3 matched user gained 3 point etc.

--in stored procedure i m using dynamic query
DECLARE @SQL VARCHAR(2000)
SET @SQL = 'SELECT U.UserID, U.StaffNo,U.FirstName+'' ''+ U.LastName AS EmployeeName,''?'' AS Points FROM tblUser U '[code]....

all filtering condition are implemented with OR logic.

## Data Controls :: Calculate Row Total And Grand Total When Using TextBox In TemplateField Inside GridView?

May 7, 2015

Calculate Row Total and Grand Total in ASP.Net GridView using jQuery

what if the price column is a template field i.e. it takes input from the user before multiplying with quantity..

## Data Controls :: Show / Hide TextBox Based On Value Of DropDownList Inside GridView?

May 7, 2015

This is my Code

My query is if i select Other in dropdownlist i want visible textbox..

how to i do it..

<asp:GridView ID="TypeFruit" runat="server">
<Columns>
<ItemTemplate>
<asp:DropDownList ID="ddlfruit" runat="server" >
<asp:ListItem Value="0">Select</asp:ListItem>
<asp:ListItem Value="1">Fruit</asp:ListItem>
<asp:ListItem Value="2">Other</asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="TxtOther" runat="server" Visible="false"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

## DataSource Controls :: How To Convert The Oracle Stored Procedure To Sqlserver 2005 Stored Procedure

Apr 2, 2010

This is surareddy. i nead some small clarification in the "Stored Procedure"

how to convert the oracle Stored Procedure to sqlserver2005/2008 Stored Procedure.

right now i am enhancing the project that project already developed the oracle Stored Procedure. now our company is using sqlserver 2005/2008.

how to convert the Oracle Stored Procedure to sqlserver 2005 Stored Procedure

## DataSource Controls :: Do Not Use Or Call Any Stored Procedure But It Says "Could Not Find Stored Procedure 'xxxxx'?

Dec 9, 2010

Initially, I have tried to use stored procedure. But I changed my mind and preferred to call sql query in codebase with command text. However, it stills tries to find initially-called stored procedure (which is neither called or exists).I think that it is related caching. But I tried it with different browsers it did not work.What might be the reason?

## Data Controls :: Enable Disable TextBox Inside GridView Based On DropDownList Selection

Apr 27, 2014

i have one dropdown list and one gridview in my page by default all the textboxes in gridview enabled if i change the dropdown value textboxes in the gridview has to disable how to implement this?

## Data Controls :: Enable / Disable TextBox Based On Selected Value Of DropDownList Inside GridView

May 7, 2015

I'm using a gridview rows, in that I'm adding the rows. I need to disable the textboxes based upon the selected value from the dropdownlist (Yes / No). This should be remain same for the previous rows when ever I'm adding new rows.

## Data Controls :: Show / Hide TextBox Based On Selected Value Of DropDownList Inside GridView

May 7, 2015

In my query i have 1 gridview..

In this gridview i have 1 dropdownlist and  1 textbox..

textbox is in visible=false state..

My question is after selecting dropdown list selected value i want visible textbox in gridview..

## Forms Data Controls :: Working Procedure With Varbinary From Existing Stored Procedure?

Feb 22, 2010

[Code]....

i have a stored procedure with this values and i need just to make a button that will send something to "Equip" column,how to do it? write the values on my webpage and make a button to exec the procedu

## Forms Data Controls :: Populate Drop Down List Using Stored Stored Procedure

Mar 14, 2010

i want data to drop down list using stored procedure .

However im not able to do that.

## DataSource Controls :: Looping Through Textbox Values And Inserting Into SQL Server Via Stored Procedure

May 9, 2010

I have a database table as follows:

[Code]....

This table receives data from my web application via a stored procedure, snippet pasted below:

[Code]....

In my quote.aspx page, I have a wizard control that collects numerous data points. In one of the wizard steps, I have 20 textbox controls for PartNumbers and 20 textbox controls for respective Quantity.

Question:How do I write a for..each loop that checks for values in my Part Number and Quantity fields and inserts them via my SQLDataSource?

## DataSource Controls :: Access Controls On Webpage Like Textbox From Stored Procedure In Sql 2008?

Dec 22, 2010

it's possible to access contrls on aps.net page like textbox from stored procedure in sql 2008.

so I get the value of the textbox on the page direct from stored procedure .

## Data Controls :: How To Highlight GridView Row Based On Condition

May 25, 2012

I want to higlight the background color based on condition

E.g. I have a column like

name       rate

rafi           100
ravi           0
karthick   300

Here rafi and karthick should display the background color

ravi should display the whitecolor

## Web Forms :: Calculate And Display DateTime In TextBox Based On Date Populated From Database

Oct 7, 2012

in my asp.net_vb web there is a text box (textbox1) in which a date is dispalyed from database (eg 21-Mar-2012) in another text box (textbox2)  i want to display

if the date is less than 30 Jun then the textbox2 should display 1 Jul+the year of textbox1

if the textbox1 date is greater than 30 Jun the text box2 should display 1 Dec + the year of textbox1

my web is in asp.net and code is in vb

## Forms Data Controls :: Hide Gridview Row Based On Condition?

May 10, 2010

I have one asp.net gridivew where i have written some code and bind it.. itz working fine now my requirment is when ever any gridview row which conatin column 3rd zero(0) i want to hide tht row ..

## Data Controls :: Change GridView Row Color Based On Condition

Jul 26, 2013

I want to change the color of particular gridview rows with an image in one row, based on condtion. How to achieve it.

## Data Controls :: How To Display Different Row Colors Based On Condition In Gridview

Jul 19, 2013

how to display row values based on condition in grid view control and how to display different row colors based on condition in grid view.

## Data Controls :: How To Blink GridView Row Based On Some Condition Using JQuery

May 7, 2015

I have to write this code to blink particular rows of gridview based on some conditions I found below link which actually does blink but after we click the row. URL...I need that the row should blink as soon as the web page loads.I also tried using the jquery as in below link but it is also giving error as.URL...

## Data Controls :: While Binding DataList / How To Bind In Next Row Based On Condition

Apr 27, 2016

I am using Datalist to bind userdetails which contains department name. With RepeatColumns="2" & RepeatDirection=" Horizontal". Now i want to check a condition while binding.for Example; If i am binding with 5 users having 3 users with same department and remaining 2 users with different departments then i want to show 1st 3 users having same department in two rows and remaining to users in next two rows.

<asp:DataList ID="dlHaysContacts" runat="server" RepeatColumns="2" RepeatDirection=" Horizontal">
<ItemTemplate>
<div class="dlSettings">
<div>
<asp:LinkButton ID="lnkHaysContactName" runat="server" Text='<%# Eval("HaysContactName") %>'

[code]....