Need to create a drop down of categories for the Post Add_entry page

Topics: Business Logic Layer
Oct 21, 2013 at 3:55 PM
Need to create a drop down of categories for the Post Add_entry page

<label class="lbl"><%=Resources.labels.categories %></label>
<asp:DropDownList ID="cblCategories" runat="server" CssClass="select-category" onselectedindexchanged="categoryDrop_SelectedIndexChanged" AutoPostBack="true" >
<asp:ListItem Text="Select Category" Value="Select Category"></asp:ListItem>
<asp:ListItem Text="Blogging" Value="Blogging"></asp:ListItem>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="cblCategories"
ErrorMessage="Error message here... " Display="Dynamic" />
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="cblCategories" Display="Dynamic" ErrorMessage="Please select your Category" ValidationExpression="Select Category"></asp:RegularExpressionValidator>
<br />

I am stuck on the javascript and C#

protected void categoryDrop_SelectedIndexChanged(object sender, EventArgs e)


private void BindCategories(Guid postId)
{ ????

Javascript on the page...

var cats = "";
var checkedCats = $("[id$='cblCategories'] option:selected").val();

var cats = "";
var checkedCats = $('.cblCategories input[type="checkbox"]:checked');
if (checkedCats.length < 2) {
checkedCats.each(function () {
var jThis = $(this);
cats += jThis.attr("id") + ",";

Currently the drop down appears on the page - but does not assign any category to the defaulted Blog Post, the url is correct... http://www.demo.something/BlogEngine.NET/post/2013/10/21/title-page-slug-line.aspx

Just need the Category to be displayed on this page - I am close but needs a bit coding in the posts/add_entry.aspx.cs and javascript... Any help would be great
Thanks, great program so far...