ASPX templates
Version 3.x > ASPX templates > How to declare values of current newsletter without chklNewsletters View modes: 
User avatar
Member
Member
romeo_osma-yahoo - 9/22/2008 5:45:59 AM
   
How to declare values of current newsletter without chklNewsletters
Hi Kentico team,

I hide the checkbox list of newsletter on my design so now you cannot choose a newsletter to subscribe that's why this error displays "Newsletter with given ID doesn't exist!" is it possible to delcare manually the ID of my desired newsletter, and how can I do that?

<div class="hidden">
<asp:CheckBoxList runat="server" CssClass="NewsletterList" ID="chklNewsletters"></asp:CheckBoxList>
</div>

Regards,
Romeo Osma
Web Designer, Techstars.NET

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 9/22/2008 6:25:29 AM
   
RE:How to declare values of current newsletter without chklNewsletters
Hi Romeo,

you could find the desired newsletter ID in the ‚Newsletter_Newsletter‘ table in your database.

Then you should re-write the code of:

your_project_folder\CMSDesk\Tools\Newsletters\Subscribers\Subscriber_Subscriptions.aspx.cs

You could remove the cycle of:

for (int i = 0; i < grvSubscriptions.Rows.Count; i++)

in ‚ButtonOK_Click‘ method.

You could use the body of this cycle and change the behaviour according your needs with the newsletterId you know from the database instead of:

Label id = (Label)grvSubscriptions.Rows.Cells[0].Controls[1];
int newsletterId = Convert.ToInt32(id.Text);


I hope this will be helpful for you.

Best regards,
Helena Grulichova