Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

How to insert multi-values in SQL through checkbox using c#?

user-image
Question added by Muhammad Abdul Jalil Muhammad Abdul Jalil
Date Posted: 2013/11/24
Bowsil Ameen
by Bowsil Ameen , Sharepoint Development officer / architect , Etihad Airways

Dear Muhammad,

 

To rephrase the question you have asked.( correct me if i am wrong)

 

have muliple values in gridview( has text box and checkbox) you have to insert all the rows which are selected

 

here is the small code sample

just place button and on the event

 

foreach(GridViewRow rw in gv_discpoint.Rows)

{CheckBox chkfill =(CheckBox)rw.FindControl("txtchk");

TextBox txtaction =(TextBox)rw.FindControl("txtAction");

TextBox txttarget =(TextBox)rw.FindControl("txttarget");

if(chkfill.Checked==true)

{

 InsertintoSQL( txtaction.Text,txttarget.Text) /// Method to insert value to sql use

}

elseif(chkfill.Checked==false)

{

// do something

}

}

 

Cheers

Ameen.S

More Questions Like This