user42348
user42348

Reputation: 4319

How to remove one item from string in a textbox

I have a gridview with 2 columns.

First field contains checkbox named chkSelect and second column is a label which is binded with EmailId.

<asp:GridView ID="gvwNewsLetter" runat="server" AutoGenerateColumns="false" DataKeyNames="UserID">
<Columns>

<asp:TemplateField HeaderText="Select">
    <ItemTemplate>
    <asp:CheckBox ID="chkSelectMail" runat="server" />
    </ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="EmailID">        
    <ItemTemplate>
    <asp:Label ID="lblEmail" runat="server" Text='<%#Eval("EmailID")%>' ></asp:Label>
    </ItemTemplate> 
</asp:TemplateField>

</columns>
</asp:GridView>

When I check each checkbox I have to display mailid in corresponding row in a textarea which is outside gridview like" [email protected],[email protected]". If I uncheck inbetween I have to remove that particular id from textbox. Can anybody help give the code to remove mailid on unchecking the checkbox.

Upvotes: 0

Views: 393

Answers (1)

schooner
schooner

Reputation: 3087

Can you not just rebuild the entire string each time a checkbox is checked/unchecked? Might be faster than trying to parse through and modify the existing string each time.

Upvotes: 3

Related Questions