I assigned some (value) to label by using some string variable.
When string variable returning value label showing the same value . but when string is not returning any value label displaying (null).
so i want to not to show anything in label if string variable is not returning anything.
if([label.text isequaltostring:#"null"])
OR
string.length==0;
OR
string.text==nil
then put
label.text=#"";
Related
In the DevExpress VerticalGrid InitNewRecord event, I am able to set the cell value when the row has a value in the fieldname property:
string zipcode = "99999";
VGrid.SetCellValue(VGrid.GetRowByFieldName("zipcode"), e.RecordIndex, zipcode);
However, for rows with no value in their fieldname property, I am unable to do so. This is not working:
string city = "unknown";
VGrid.SetCellValue(VGrid.Rows["rowcity"], e.RecordIndex, city);
The row's (Name) property contains the value rowcity. I'm trying to get the row by its name.
I have also tried
string city = "unknown";
VGrid.SetCellValue(rowcity, e.RecordIndex, city);
where I'm trying to get the row using the member that has been automatically created.
I've also tried casting rowcity to BaseRow:
string city = "unknown";
DevExpress.XtraVerticalGrid.Rows.BaseRow mybaserow;
mybaserow = (DevExpress.XtraVerticalGrid.Rows.BaseRow) rowcity;
VGrid.SetCellValue(mybaserow, e.RecordIndex, city);
Have also tried via Properties:
VGrid.SetCellValue( rowcity.Properties, e.RecordIndex, "unknown");
but no joy.
What am I overlooking?
The CustomUnboundData event is how to accomplish this.
EDIT: In a rush, sorry...
The event fires as many times as there are unbound fields.
In the eventhandler, you examine the eventargs fieldname property (in a switch statment) and set the value of the fieldname(s) you want to set.
I am using a List(of T) in my VB.Net/ASP.Net project. While displaying the list on ASP.net, I am using #Eval, but my date (After formattin) is always displaying the MinVal insteaad of Null Spacs. How to check for date.min on #Eval to get the date as " " when its equal to Date.Min Val
DateTime object can not be Null by default until you define it Nullable. If you want DateTime object to be able to hold null as value then you need to define the object data type as Nullable and explicitly assign Null. By default, any DateTime object is assigned the Min value.
If you want to check if date has Min value, either you can user DateTime.MinValue property or create a new DateTime object (It will be assigned Min value by default) then compare with that object.
[Example]
Public Property MyDate As DateTime?
' get value
<asp:someElement attr='<%# If(Eval("MyDate") Is Nothing, " ", CType(Eval("MyDate"), DateTime?).Value.ToShortDateString()) %>'></asp:someElement>
In ASP.net is the following code right ?
Dim r1 As Bollean = rd1.checked
checkbox returns what type of value?
then when I put this following code---
If Request.QueryString("r3") Then
myReportDocument.Load(Server.MapPath("Gradewise.rpt"))
End If'
It gives following error--
Conversion from string "" to type 'Boolean' is not valid.
.checked property returns a boolean value.
And regarding error that you are getting - you are trying to put a string in a if statement while a condition which returns either true or false is expected.
So it should be
'If Request.QueryString("r3")="some string to compare" Then ...
as Request.QueryString("r3") returns a String!
You need to use Checked property of checkbox to get the checked status of checkbox. rd1.checkbox would return object of type CheckBox
Dim r1 As Bollean = rd1.checkbox.Checked
Edit as OP is edited. You have to give expression that results in boolean in if statement.
If Request.QueryString("r3") == "somevalue" Then
myReportDocument.Load(Server.MapPath("Gradewise.rpt"))
End If'
I have an ASP.NET site (either .NET 2.0 or 3.5), and I want to get the selected item of two drop down boxes (call them a and b). B is updated with appropriate values depending on what is selected for A.
However, the following code:
string val = dd1.SelectedItem.Text;
Returns a value of "not selected". Why is this?
Thanks
The only way this could happen is if you have "not selected" set as either the Text property of your selected item, or if Text is null then the Value property will be returned.
From MSDN's documentation on ListItem (which is what SelectedItem inherits from):
If the Text property contains null,
the get accessor returns the value of
the Value property. If the Value
property, in turn, contains null,
String.Empty is returned.
How can I remove particular value from query string for e.g Default.aspx?name="my name is abc"?
I want to remove 'abc' from above query string .
How can I do that??
I just want to show 'my name is' as a output.