Tell me more ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have created a custom New.aspx for a custom list with visual studio. I have designed user control for this. I'm able to submit the items to the list.

However, i have a problem with attachment file and adding it to the list. This is the code that i use to add an attachment to the custom list.

SPListItem currentItem = SPContext.Current.ListItem;             
MyAttachments.UpdateFieldValueInItem();
currentItem.Update();

When i debug the code , i could see that MyAttachments is null, i'm clueless .

Your suggestions/help is appreciated.

share|improve this question
Can you include more code? Where are you defining or setting MyAttachments? Without more code, this question is not answerable. – Kit Menke Mar 8 '12 at 16:20
I'm adding this control in the user control. <SharePoint:AttachmentsField runat="server" FieldName="Attachments" ID="MyAttachments" ControlMode="New" /> – Krishna Prasad Mar 12 '12 at 11:31

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.