Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public string GenerateNestedMenus(string fTableName, string fID, string fCluase)
- {
- string output = "";
- string x = DateAndTime.Now.ToString();
- SetActionResult = "waiting_GenerateNestedMenus";
- string OutputData = "";
- string SQLCommand = null;
- CoreString _string = new CoreString();
- SQLCommand = "SELECT * FROM " + fTableName + " WHERE MenuParent=@ID AND Visible=1 AND " + fCluase;
- SqlDataReader DR = default(SqlDataReader);
- DeepDB DB = new DeepDB(__ConnectionString, SQLCommand, fTableName);
- DB.ddConnect();
- SqlParameter IDParameter = new SqlParameter("@ID", fID);
- DB.ddAddParameper(IDParameter);
- string temp = null;
- try {
- DR = DB.ddExecuteReader();
- while (DR.Read) {
- if (Convert.ToInt32(ChildCounter(fTableName, DR("id"))) > 0) {
- temp = "<li>" + Constants.vbCrLf + "<a href='#'>" + Strings.Trim(DR("MenuName")) + "</a>" + Constants.vbCrLf + Constants.vbTab + "<ul> ";
- _temp += temp;
- GenerateNestedMenus("menus", DR("id"), fCluase);
- _temp += Constants.vbTab + "</ul>" + Constants.vbCrLf + Constants.vbTab + "</li>" + Constants.vbCrLf;
- } else {
- //For rows they have not child
- temp = Constants.vbTab + "<li><a href='#'>" + Strings.Trim(DR("MenuName")) + "</a>" + "</li>" + Constants.vbCrLf;
- _temp += temp;
- GenerateNestedMenus("menus", DR("id"), fCluase);
- }
- SetActionResult = "done_GenerateNestedMenus";
- }
- output = _temp;
- } catch (Exception exp) {
- SetErrorMessage = "GenerateNestedMenus():" + exp.Message;
- SetActionResult = "error_GenerateNestedMenus";
- } finally {
- DB.ddClose();
- }
- return output;
- }
Advertisement
Add Comment
Please, Sign In to add comment