<asp:DataList ID="subcategorydatalist" runat="server" RepeatColumns="3" RepeatDirection="Vertical"> <ItemTemplate> <asp:CheckBox ID="chksubcategory" runat="server" Text='<%# Eval("SubCategory") %>' /> </ItemTemplate> </asp:DataList>
protected void Page_Load(object sender, EventArgs e) { if (Session["UserID"] != null && Session["UserID"] != "") { UPOBJ.U_UserID = Convert.ToString(Session["UserID"]); UPOBJ.U_UserType = Convert.ToInt32(Session["UserType"]); Session["ID"] = UPOBJ.U_UserID; } else { Response.Redirect("~/Login.aspx?ReturnUrl=" + Request.Url.PathAndQuery.Replace("&", "^")); } if (Request.QueryString["YPID"] != null && Request.QueryString["YPID"] != "") { LPOBJ.L_YPID = Convert.ToInt32(Request.QueryString["YPID"]); } else { AlertMessage("Please Select the Record For Editing"); Response.Redirect("EditListing.aspx"); } if (!IsPostBack) { dr = ABLOBJ.GetYPInformationListingByID(LPOBJ); if (dr.HasRows) { while (dr.Read()) { txtYPID.Text = dr["YPID"].ToString(); txtCategory.Text = dr["Category"] != null ? Convert.ToString(dr["Category"]) : ""; txtSubCategory.Text = dr["SubCategory"] != null ? Convert.ToString(dr["SubCategory"]) : ""; txtCompanyName.Text = dr["CompanyName"] != null ? Convert.ToString(dr["CompanyName"]) : ""; UPOBJ.U_Category = txtCategory.Text.ToString(); } } ds = ABLOBJ.GetRelatedSubCategories(UPOBJ); ds1 = ABLOBJ.GetSelectedSubCategories(LPOBJ); subcategorydatalist.DataSource = ds; subcategorydatalist.DataBind(); } }
declare @subcategorys nvarchar(100) declare @sQuery NVarchar(max) set @subcategorys =(select othersubcategories from ypinformation1 where ypid=10) set @sQuery ='select SubCategory from SubCategories where SubCategoryID in ('+@subcategorys+')' exec sp_executesql @sQuery
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)