Comma added at the end of values using Request.Form

Have you ever faced any problem of comma added at the value end while using Request.Form. If yes then lets see what is the reason behind this. I faced this problem while getting the values from the form and I was getting the values using Request.Form. In my case my entire form is getting generated dynamically but here we will just take two fields just to clear the concept.
 
 
 
 
If you see the above image you will find out the output Demo,I am developer. This output is the values from the entry I added in two textboxes which is above the output. You will think that might I retrieve the values of both textboxes, but not, I am just retrieving the values of one textbox which is for Name. So if I added Demo in that then why I am getting the values Demo with comma added at last and the Work Description values with this.
 
Reason behind this
 
 
 
Code behind image
 
You can see in the above image we have two textboxes with the same id for Name and Work Description, so it means we have duplicate form fields, that's why we getting the value concatenated with the comma, so whenever you face this kind of issue make sure the element ids should be unique. If form values are duplicate it will add comma at the end of each element value even if the second duplicate element is empty, still it will add the comma at the end. Hope this will help you.
 
 "enjoy the coding! ;)" 
Ebook Download
View all
Learn
View all