从另一个页面重定向页面url来自数据库并绑定在div中

时间:2017-09-08 08:03:09

标签: c# asp.net

我想重定向页面点击div标签,但它可以重定向div从数据库填充。如何通过单击div来重定向。

protected void Page_Load(object sender, EventArgs e)
{
    SqlHelp.CNSTR = con;
    DisplayMenuList();                  
}

protected void DisplayMenuList()
{
    DataTable dtMenuList = new DataTable();
    string strSql = "select * from ModuleMaster where IsActive='Y' order by ModuleName asc";
    string appendHtml = string.Empty;
    dtMenuList = SqlHelper.SqlHelper.ReturnDataTable(strSql);
    if (dtMenuList != null && dtMenuList.Rows.Count > 0)
    {
        for (int i = 0; i < dtMenuList.Rows.Count; i++)
        {
            appendHtml += "<div class='verticallyCenter' style='width: 20%; float: left;display:block;'><a href='/Admin/" + Convert.ToString(dtMenuList.Rows[i]["ModuleUrl"]);
            appendHtml += "'><input type='image' name='" + Convert.ToString(dtMenuList.Rows[i]["ModuleName"]);
            appendHtml += "' id='" + Convert.ToString(dtMenuList.Rows[i]["ModuleName"]);
            appendHtml += "' src='../" + Convert.ToString(dtMenuList.Rows[i]["ImageUrl"]) + "' class='MenuButtons'/></a>";
            {
                appendHtml += "<span class='MenuNotification'>" + i + "</span>";
            }
            appendHtml += "</div>";  
       }
    }
    divMenuList.InnerHtml = appendHtml;
    appendHtml = HttpContext.Current.Request.Url.AbsoluteUri;
}

0 个答案:

没有答案