Click here to Skip to main content
16,018,534 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am creating a Request form.when submitting data to sharepoint i ned to generate RequestID like

"2010-1"
"2010-2"etc...for every request one id.

I have tried using concatination of Year with ID field...no use
use Hidden field...no use..

so anyone can pls tell me how to do that??
Posted

1 solution

Dear,
You have create custom page using User controls and webpart. Then you can use .Net code Logic for generating request id.


Use Object model for inserting items in List. Below is steps for that

Steps:
1. Create an User Control and use Microsoft.Sharepoint namespace by using keyword.

2. on add or submit button, use your generate requiest id logic and then SPSite mySite=new SPSite["Url"];
SPWeb myWeb=mySite.openWeb();
SPList myList=myWeb.List["ListName"];
SPListItem NewItem = ListName.Items.Add();
use columns as you have
myList.Name=txtName.text.trim();
Same as other columns
NewItem["Name"] = txtAskSaad.Text;
NewItem"Date"] = System.DateTime.Now;
CurrentWeb.Update();

3. Create a class type solution in Visual Studio 2005 and then
use user control on that webpart.

3. deploy solution
4. entry in web.config as safe control

and use this webpart in your application


Hope it will help you.
 
Share this answer
 
Comments
.netram 2-Jul-10 7:02am    
Hi Lalit,

Thanks for the reply...
I have completed everything..except GENERATING REQUEST ID while submitting...
My sharepoint list has one Field named:---Request_ID.

When we click on SUBMIT know..automatically the Request ID should get created on sharepoint list.
Logic??? for generating Request ID...is what i need...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900