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.