Hello,
I wrote a function in vb.net and i Sent her parameter.
The function is used in a table cell.
I want the function to use a field value,
I tried :
Fileds!myFilesName.Value
But it didn't work.
Can I do this kind of thing?
Thanks.
Are you trying to write or read from a table cell? Or is it from a control in the table cell?
Hi TaTworth.
I'm trying to read the value from the current row in the dataset and write it to the table cell.
I'll will try to explain again:
I have a table in my report.
in one of the cells I have a filed. something like:
=Fields!FieldName.Value
Now, Let say I want to add him the value "2". I will use:
=Fields!FieldName.Value + 2
Now, let say that I want to call a function that will add him the
value "2" and return the result.
I can use the following call:
=Code.AddTwoFunction(Fields!FieldName.Value)
And in my code I will get the Filed value as parameter and add him the
2.
What I wanted to know is if I can call the function with out the
parameter and tell her to automaticlly get the value of the field from
the row she was called?
The reason I need this is that I have a function that need to get 5
fileds and when I call it it looks some thing like:
=Code.AddTwoFunction(Fields!FieldName.Value,Fields!
FieldName2.Value,Fields!FieldName3.Value,Fields!
FieldName4.Value,Fields!FieldName5.Value)
What I would like to do is to call the function from the cell like =Code.AddTwoFunc()
and inside the function use something like:
dim str = Fields!FieldName.Value + 2;
The problem is that it doesn't recognize the"Fields!FieldName.Value"
Hope I explain my self better
|||
Shalom Shabbat AspNetO
You can go two ways - one way is to modify the dataset prior to binding to a datagrid, the other is to set up a suitable table structure to contain all your data cells, giving each cell its own runat="server" and its own id value, you can then read and write from each cell. When reading use a NullToString functions as in http://forums.asp.net/p/1091080/1635818.aspx#1635818 and then cast the string to an integer.
Thus if the contents of tddA1, tddA2 are to be added to give tddA3, then
string sA1 = NullToString(tddA1.InnnerText);
string sA2 = NullToString(tddA2.InnnerText);
int iA1 = System.Convert.ToInt32(sA1);
int iA2 = System.Convert.ToInt32(sA2);
tddA3.InnerText = (iA1 + iA2).ToString();