Thursday, December 27, 2012

Disable Button after click

ASP.Net
Disable asp.net button after clicked

1st step: Create Java script function to disable the button




---------------------------------------

2nd step:call the function onclientclick action for the button

OnClientClick="disableBtn(this.id, 'Upload data ')" UseSubmitBehavior="false"


Wednesday, December 5, 2012

Best Android Tablet

What is the best android tablet right now in the market ?

  • Google Nexus

yes nexus is the best one in the market. we have google nexus 7 and google nexus 10.

for me i will go with the Nexus 10. tablet large screen is so important for productivity and fun too

Nexus 10 is even thinner than the ipad it is 8.9mm while ipad is 9.4mm
it has a great screen with resolution 2560 x 1600 pixel.
operating system: jelly Bean.
processor: 1.7 GHZ Dual-core
Ram: 2GB
Rear Camera: 5 Mega pixel
Front Camera: 1.9 Mega Pixel
GPS
Wi-Fi
Microphones
Accelerometer
9,000mAh battery - 8 hours

There is two things i don't like in this great tablet :

  1. No external memory.
  2. Battery life.
Come on google we are not asking for too much just and SD card, it is not a big deal to support it.




Tuesday, December 4, 2012

Touch Screen Laptops

New touch screen laptops is not a such good idea in my opinion , as they just made those screens touchable and installed them on the current laptops just because of windows 8 touchable features.

you can not just make the current laptops screen touchable without change the laptop design it is not working like that.
every time you touch the screen it moves to the back and vibrate.
 
hardware companies should create new designs for the laptops to handle the touch technology to make it usable and user friendly devices.
 
some companies like lenovo did that already and came out with new designs .

 the current design for windows 8 is good for tablets only, Microsoft must create another interface for desktops and laptops . metro style is so confusing interface when you use it on a regular PC.

  I am happy with my windows 7 on my desktop and laptops.
if i will use windows 8 i will use it on tablet only.

 let me know your opinions also about touch screens on regular laptops and windows 8 metro style on desktop.




 

Tuesday, July 24, 2012

ACESS NOT IN Query Issue

Not in statement in access returns no results even I know well that there is some records not in the sub query table.

After searching this issue the only reason I found, if there is null values in the sub query selected list
Then the (not in sub query) statement not working in the way it should
To make not in statement work correctly in MS-Access you should remove the null values then it will return correct results

SELECT *
FROM TABLE1
WHERE TABLE1.C1 NOT IN
(SELECT TABLE2.C2 FROM TBALE2);

Thursday, July 5, 2012

How to disable Asp.Net button after been clicked

1st step: Create Java script function to disable the button and added to the web page


<script language="javascript">

function disableBtn(btnID, newText) {


var btn = document.getElementById(btnID);


setTimeout("setImage('"+btnID+"')", 10);


btn.disabled = true;


btn.value = newText;


}


</script>

2nd step:  Add script to the button

OnClientClick="disableBtn(this.id, 'Upload data ')" UseSubmitBehavior="false"

Saturday, June 12, 2010

asp.net: How to disable asp.net button after clicked

1st step: Create Java script function to disable the button



function disableBtn(btnID, newText) {
var btn = document.getElementById(btnID);
setTimeout("setImage('"+btnID+"')", 10);
btn.disabled = true;
btn.value = newText;

}

2nd step:
Call onclientclick action for the button

OnClientClick="disableBtn(this.id, 'Upload data ')" UseSubmitBehavior="false"
Oralce SQL:
Select the maximum date from each month in a date column .
column named (date_col) contains dates and you would like to select the maximum date from each month in this column.

select max(date_col)
from table_name
group by to_char(date_col,'mm'),to_char(date_col,'yyyy')
ORACEL SQL.
How to List dates between two dates interval

select to_date('Start_date','dd-mm-yyyy') + rownum -1
from all_objects
where rownum <= to_date('End_date','dd-mm-yyyy')-to_date('Start_date','dd-mm-yyyy')+1

Tuesday, April 7, 2009

ListBox Selected Values

Listbox selected values string separated with “,”

Dim li As ListItem
Dim x As Integer = 0
Dim Strv As String

For Each li In LB_users.Items
If li.Selected = True Then
strv = li.Value + "," + txt_users.Text
strv = strv.Remove(strv.Length - 1)

End If

Next

Wednesday, March 25, 2009

Money Validation

Money field validation using controlvalidator

<_asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="TextBox1"
ErrorMessage="Invalid Amount"
Operator="DataTypeCheck"
Type="Double">

Tuesday, March 10, 2009

Row number for grouped data

Rownumber function returns the number of the row of the dataset

EMP_NAME
Emp1
Emp2
Emp3
Emp3
Emp3
Emp4

If we would like to groupby EMP_NAME and show the row number beside each row, the result will be :

Row number EMP_NAME
1 emp_1
2 emp_2
3 emp_3
6 emp_4

As you can see the row number value is not correct, actually it is correct because the rownumber function returns the number of row inside the dataset not inside the grouped data in the report

Now we need to display the row number for what we see in the report instead of what is inside the dataset

I am going to use runningvlaue function for the grouped data inside "table1"

=runningvalue(Fields!EMP_NAME.Value,countdistinct,"table1")

Result:

Rownumber EMP_NAME
1 emp_1
2 emp_2
3 emp_3
4 emp_4

Runningvalue function: accumulates the result of any aggregate function except for rownumber and runningvalue.

Monday, March 9, 2009

Next line command

How to display data in the next line inside the same data field


=Fields!EMP_Name.Value & System.Environment.NewLine() & Fields!EMP_Address.Value

Result:

EMPNAME
ADDRESS

Friday, March 6, 2009

Report page footer

Add page number to Reprot Page Footer

="Page " & Globals!PageNumber

Result: Page1, Page2,…..etc

To display the total number of pages you can use “Globals!TotalPages”

="Page " & Globals!PageNumber & "of " & Globals!TotalPages

Result: “Page1 of 2”, “Page2 of 2”

Thursday, March 5, 2009

Row number

Select the first n rows
the following example show how to retrieves the first 15 rows

select emp_name, salary
from employee
where rownum <=15


if you want to retrieve data between row number 10 and row number 15
then it should be in the following way

select emp_name, salary
from
(select rownum r ,emp_name, salary
From employee )
Where r >=10 and r<=15

Wednesday, March 4, 2009

Report image

How to add image to RDLC report

1st step: open your RDLC report add image from report items to your report.

2nd step: Report main menu select REPORT then Embedded Images click new image then select the image you would like to add.

3rd step: go to image properties Source select Embedded.

4th step: go to image properties Value you will find the image name you just embedded, select it.

Now you can see the image inside the report

Tuesday, March 3, 2009

Field format

Replace null values with 0 inside the RDLC report

The following statement replaces the null value with 0 else it keeps the default value
place the code inside the field expression

=iif(Parameters!emp_salary.Value like "",0,Parameters!emp_salary.Value)

Aslo you can replace a specific string with another one
For example if the string begin with “REJ” replace it with “Rejected”

=iif( left(Fields!EMP_ENROLLMENT.Value,3) like "REJ","Rejected",Fields!EMP_ENROLLMENT.Value)

Monday, March 2, 2009

Connection string

Create Oracle connection string using APP.CONFIG file

<_connectionstrings>

< name="CONN_NAME" connectionstring="Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.250.10.10)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SID=SIDNAME)));User Id=username;Password=password">

< /connectionStrings >


Second step.
open the connection string

Imports Microsoft.VisualBasic
Imports System.Configuration
Imports System.Data
Imports System.Data.OracleClient
Imports System.Exception


Dim conn As OracleConnection

Try

conn = New OracleConnection(ConfigurationManager.ConnectionStrings("CONN_NAME").ConnectionString)

Catch ex As Exception
Throw ex
Finally
conn.Dispose()
End Try

Friday, February 27, 2009

Search Selected items

How to search for selected items in a drop down list or compo box

The selected items string should be in the following format
(first item,second item,third item,….)

Then you can use the SQL (IN clause) to retrieve the data
For some reason in ORACLE SQL, you should make the select statement as string to make it work else you will get no thing while if you are using sql server you don’t need to do that

See the following stored procedure

CREATE OR REPLACE PROCEDURE SP_Search_Emp(
ESTATUS IN VARCHAR2,ETYPE IN VARCHAR2,CUR_E_STATUS_TYPE OUT SYS_REFCURSOR )
AS
STR_ESTATUS VARCHAR2(9000);
STR_ETYPE VARCHAR2(9000);
CS VARCHAR2 (15000);

BEGIN

Select ''''Replace(ESTATUS,',',''',''')'''' into STR_ESTATUS from dual;
Select ''''Replace(ETYPE,',',''',''')'''' into STR_ETYPE from dual;

cs:='SELECT e.emp_id,e.emp_name,e.emp_address,e.emp_salary,e.emp_status,e.emp_type

FROM Emp_table e

WHERE emp_Status IN';
cs := cs '('upper(STR_ESTATUS)') AND emp_type IN (' str_etype')
)';

open cur_E_status_type for cs;
END SP_Search_Emp;

Ref Cursor

Ref cursor is one of the most powerful ways to return stored procedures query results from oracle database.
The following example shows how to use oracle ref cursor .


CREATE OR REPLACE PROCEDURE SP_EMP (CUR_EMP OUT SYS_REFCURSOR) AS

BEGIN
OPEN CUR_EMP FOR
SELECT EMP_FNAME, EMP_LNAME, EMP_DATA
FROM EMPLOYEE

Thursday, February 26, 2009

Date Interval

Today I am going to show you how to list the months and years between two dates interval using Oracle SQL

Select distinct to_char(create_date,'MON-yyyy')as Create_Date from
(
SELECT TO_DATE('10/01/2008', 'MM/dd/YYYY') + rownum as create_date
FROM all_objects
WHERE TO_DATE('10/01/2008', 'MM/dd/YYYY') + rownum <= TO_DATE(to_char(sysdate,'mm/dd/yyyy'),'MM/dd/YYYY') )


Result :

OCT-2008
NOV-2008
DEC-2008
JAN-2009
FEB-2009