|
indian143 wrote: I have an asp.net application which loads data from csv file. I need to check for duplicate rows in the csv file and should not process them and give error message for those duplicate rows.
Here's my approach:
ArrayList uniqueLines = new ArrayList();
ArrayList duplicateLines = new ArrayList();
String[] lines = File.ReadAllLines( "C:/file.csv" );
foreach ( String line in lines )
{
if ( !uniqueLines.Contains( line ) )
{
uniqueLines.Add( line );
}
else
{
duplicateLines.Add( line );
}
}
From the above, you have all the unique lines in the uniqueLines arraylist and you have duplicate lines in the duplicateLines arraylist.
To display errors, loop through the "duplicateLines" and tell the user about the error.
Happy Coding,
Morgs
|
|
|
|
|
Can I use List instead of ArrayList, because that class is not coming in my application, I dont know why?
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
Yes, you can use List<string> if you want. The ArrayList comes from the: using System.Collections;
|
|
|
|
|
Hi,
Is there any way to get the which rows are repeated, like for example row 1, 3, 5 are same and 2 and 4 are same.
Is there any way to get that from this list?
thanks,
Abdul.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
Hi,
For when click datalist item show pupup on parent window i use this code :
any other???????
protected void dlPhotos_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "Select")
{
Response.Write("<script>");
Response.Write("window.open(Default3.aspx','_self','toolbar=0,location=0,menubar=0,resizable=0,width=400,height=320')");
Response.Write("</script>");
}
}
|
|
|
|
|
Jitendra Parida1987 wrote: ItemCommand(object source, DataListCommandEventArgs e)
this is server side code which will get executed the user clicks a button in your DataList. I am assuming that your expected behavior is not working.
since everything in your script appears to be static why not just write the script code into your .aspx page directly? add your control and on the click event call your javascript function. the only thing you need change is returning false so that it won't post back.
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
Hi,
My requirement is dynamically implement so that i try this code.
|
|
|
|
|
Jitendra Parida1987 wrote: My requirement is dynamically implement
dynamically implement??
there is nothing dynamic about that script that you posted so why not just put it in a static javascript function that gets called from each item in the DataList. the html code that gets displayed is dynamically generated on the server so maybe that is it??
sounds like a homework assignment when you mention it this.. haha
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
hi,
please tell me what is problem in my code???????
|
|
|
|
|
Hi,
I have tried to deploy my web application (VS2010 + C#) by adding the project output and building a msi setup. But, I want to do these steps through command prompt. Our command scripts will do all the stpes to deploy in server.
That command prompt scripts should do the following things
1. Getting latest version of my solution
2. Adding web deployment project and adding project outputs there
3. Building and deploying in a server..
How to do that?
Thanks in advance.
Balasubramanian K.
|
|
|
|
|
hi
Request.ServerVariables("REMOTE_HOST") does not work on IIS 7. but work on IIS 5.1 and 7.5.
what problem can be?
|
|
|
|
|
i am looking for vertical according menu for asp.net shopping cart project.
the menu items accessed from database, please advice me how can i do that.
Thank you
NInad
|
|
|
|
|
There are javascript menu codes available
Please find the below link if its helpful for your query.
http://www.dynamicdrive.com/
Regards
Naina
Naina
|
|
|
|
|
|
Hi,
follow this example for dynamic menu.
http://chandradev819.wordpress.com/2011/07/03/how-to-bind-asp-net-menu-control-with-database
|
|
|
|
|
Dear,
When we are hosting a web site on server which steps to follow the configuration a domain name to a static ip address.
|
|
|
|
|
Please repeat the question ?
But make smaller sentences ?
What do you really wish to know ?
Kribo
http://blog.kribo.be
|
|
|
|
|
hello,
My objective is that i am create a virtual directory for my website how to set domain just like: "www.codeproject.com" and static ip to global access my website.
|
|
|
|
|
Dear
Please be specific. I might be different based on your shared hosting or dedicated hosting. I have a shared hosting and it doesn't ask me for such kind of configuration.
thanks & regards
Nitish Arora
Web developer (Learner)
|
|
|
|
|
How to create keep me logged in code on asp.net?
|
|
|
|
|
What have you tried for yourself? Hint: you could use Session to maintain the logged in state of users.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
I create a login page here put a check box for keep me logged on.
but i have know knowledge for implement that one.
any one help on c#.
|
|
|
|
|
|
I have following code in a user control in my application
imgbtn2.Click += new ImageClickEventHandler(imgbtn2_Click);
imgbtn2.Command += new CommandEventHandler(imgbtn2_Command);
imgbtn2.Unload += new EventHandler(imgbtn2_Unload);
this code resides in an event handler of another button and imgbtn2 is dynamically created in that event handler.
In fact I only need an event handler for when the ImageButton control is clicked ,but I have about tried anything, but can't find a way to call the event handler. The very weird thing is that the imgbtn2_Unload function is called, but not the other two (Click, Command).
I tried adding the handlers in about every page load event I could find (PreRender, UnLoad, ...) and debugged completely through it. I also tried to create a User Control to be used withing this User Control, but nothing seems to work (the controls, a label and a button remain null ?). I even tried to only start assigning events/properties in the load events (PreRender, UnLoad, ...) of the panel where the controls reside, but nothing works.
So what am I doing wrong here? I've looked around in google, but none of the solutions seem to work.
The goal is to dynamically add controls to a panel.
Many thanks.
V.
|
|
|
|
|
I am getting error when I tried retriving a single row from my LINQ query. This is my code:
Dim query = From mm In dataContext.Mail_Message
Group Join mmr In dataContext.Mail_MessageRecipient On mm.MailMessageId Equals mmr.MailMessageId Into mmrm = Group From mrm In mmrm.DefaultIfEmpty
Group Join u In dataContext.Application_User On mm.SenderId Equals u.UserId Into us = Group From ums In us.DefaultIfEmpty
Group Join sr In dataContext.Personnel_StaffRecord On ums.StaffRecordId Equals sr.StaffRecordId Into srm = Group From smrm In srm.DefaultIfEmpty
Group Join ma In dataContext.Mail_MessageAttachment On mm.MailMessageId Equals ma.MailMessageId Into mam = Group From mamm In mam.DefaultIfEmpty
Where mm.MailMessageId = messageId
Select mrm.MailMessageRecipientId, smrm.Surname, smrm.Firstname, smrm.Othername, mm.Date, mm.Subject, mm.MailContent
If query IsNot Nothing Then
Dim row = query(1)
With result
.MailMessageId = row.MailMessageRecipientId
.Sender = CStr(IIf(row.Surname Is Nothing, "BISM Limited", String.Format("{0} {1} {2}", row.Surname, row.Firstname, row.Othername)))
.Subject = row.Subject
.Body = row.MailContent
.Dates = row.Date
.RecipientNames = GetMailRecipients(messageId)
.Attachments = GetMailAttachments(messageId)
End With
ReadMessage(row.MailMessageRecipientId)
End If
This is the error I get:
LINQ to Entities does not recognize the method 'VB$AnonymousType_48`7[System.Int64,System.String,System.String,System.String,System.DateTime,System.String,System.String] ElementAtOrDefault[VB$AnonymousType_48`7](System.Linq.IQueryable`1[VB$AnonymousType_48`7[System.Int64,System.String,System.String,System.String,System.DateTime,System.String,System.String]], Int32)' method, and this method cannot be translated into a store expression.
What am I getting wrong here?
|
|
|
|