validate excel cell values in asp.net

Posted by Lakn2 under Regular Expressions on 7/13/2011 | Points: 10 | Views : 2709 | Status : [Member] | Replies : 5
Hi,
How can i validate excel cell values in asp.net

Thanks&Regards
LakshmiNarayana Nalluri.



Responses

Posted by: Naimishforu on: 7/13/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
There are so many ways to validate it.

Can you please brief in details as what validation criteria you have and somewhat overview about how you are building your project, that would be very much helpful to provide you guidance.


Thanks,
Naimish
http://dotnetinterview.zxq.net/
http://naimishpandya.blogspot.in/

Lakn2, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: RaviRanjanKr on: 7/13/2011 [Member] Starter | Points: 25

Up
0
Down
Please be more specific while asking question. we need more information about your question. if possibly include your effort or show codes in your question.

Thanks
Ravi Ranjan Kumar
http://raviranjankr.wordpress.com

Lakn2, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lakn2 on: 7/14/2011 [Member] Starter | Points: 25

Up
0
Down
hi i have one excel sheet with some table like

id name address
anc hyd
2 bns bza
3 12s wert
4 dsfsdf 123

Now i want to check which cell is empty and name cell should be allow chars only and address field allow numerics and chars .And we should return cell no also which
is incorrect.Entrie this is in Asp.Net

Thanks&Regards
LakshmiNarayana Nalluri.

Lakn2, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naimishforu on: 7/14/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Ohh, I have done similar recently.

You can loop through all the excel sheet (or you can take whole excel sheet in datatable and loop through it).

The following code snippet will change all the Null values in the DataTable to 0.

' The query will return only rows that have at least one Null value

' in one of the columns
Dim results = From row In DataTableInstance.AsEnumerable() _
Where row.ItemArray.Any(Function(c) c Is DBNull.Value) _
select row

' Replace all the Null values with zero
For Each r in results
For i As Integer = 0 To r.ItemArray.Count( ) - 1
If r(i) is DBNull Then
r(i) = 0
End If
Next
Next

' At this point DataTableInstance has no Null values in it.


Thanks,
Naimish
http://dotnetinterview.zxq.net/
http://naimishpandya.blogspot.in/

Lakn2, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lakn2 on: 7/14/2011 [Member] Starter | Points: 25

Up
0
Down
Hi Naimishforu ,
if you don't mind can you send me code what you had done.

Thanks&Regards
LakshmiNarayana Nalluri.

Lakn2, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response