i have created a div using stringbuilder which result as below picture
below are my coding
protected void Page_Load(object sender, EventArgs e)
{
int divID = 0;
using (SqlConnection stud = studPortConn.GetStudPortCon())
{
stud.Open();
da.SelectCommand = new SqlCommand("SELECT moduleID,moduleDesc FROM Module WHERE systemID = '3'", stud);
SqlDataReader sc = da.SelectCommand.ExecuteReader();
if (sc.HasRows)
{
while (sc.Read())
{
divID++;
var modID = sc["moduleID"].ToString();
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("
if (stringBuilder.Length > 0)
{
divtajukText.Controls.Add(new Literal { Text = stringBuilder.ToString() });
divtajukText.Visible = true;
}
divtajukText.Controls.Add(new LiteralControl("
"));
}
}
}
}
}
{
int divID = 0;
using (SqlConnection stud = studPortConn.GetStudPortCon())
{
stud.Open();
da.SelectCommand = new SqlCommand("SELECT moduleID,moduleDesc FROM Module WHERE systemID = '3'", stud);
SqlDataReader sc = da.SelectCommand.ExecuteReader();
if (sc.HasRows)
{
while (sc.Read())
{
divID++;
var modID = sc["moduleID"].ToString();
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("
");
stringBuilder.AppendFormat("
stringBuilder.Append("
stringBuilder.Append("
");stringBuilder.AppendFormat("
" + sc["moduleDesc"].ToString() + "
");stringBuilder.Append("
");
stringBuilder.Append("
stringBuilder.Append("
");stringBuilder.Append("
");
using (SqlConnection stud1 = studPortConn.GetStudPortCon())
{
stud1.Open();
da.SelectCommand = new SqlCommand("SELECT moduleID,menuDesc,menuPath FROM Menu WHERE moduleID='" + modID + "'", stud1);
SqlDataReader sc1 = da.SelectCommand.ExecuteReader();
if (sc1.HasRows)
{
while (sc1.Read())
{
stringBuilder.AppendFormat("
}
}
stringBuilder.Append("
");using (SqlConnection stud1 = studPortConn.GetStudPortCon())
{
stud1.Open();
da.SelectCommand = new SqlCommand("SELECT moduleID,menuDesc,menuPath FROM Menu WHERE moduleID='" + modID + "'", stud1);
SqlDataReader sc1 = da.SelectCommand.ExecuteReader();
if (sc1.HasRows)
{
while (sc1.Read())
{
stringBuilder.AppendFormat("
" + "" + sc1["menuDesc"].ToString() + "" + "
");}
}
stringBuilder.Append("
stringBuilder.Append("
stringBuilder.Append("
if (stringBuilder.Length > 0)
{
divtajukText.Controls.Add(new Literal { Text = stringBuilder.ToString() });
divtajukText.Visible = true;
}
divtajukText.Controls.Add(new LiteralControl("
"));
}
}
}
}
}
how do i make the third and so on created div, position in second column and third column adding in my coding?.. please anyone help me..TQ so much.
Hazel MahmudPosted Nov 25, 2015, 9:35 PM
Hazel MahmudPosted Nov 17, 2015, 7:36 PM
View all
aspx.cs code
{
int divID = 0;
using (SqlConnection stud = studPortConn.GetStudPortCon())
{
divID++;
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("
stud.Open();
da.SelectCommand = new SqlCommand("SELECT moduleID,moduleDesc FROM Module WHERE systemID = '3'", stud);
SqlDataReader sc = da.SelectCommand.ExecuteReader();
if (sc.HasRows)
{
while (sc.Read())
{
var modID = sc["moduleID"].ToString();
stringBuilder.Append("
//if (divID > 2)
//{
stringBuilder.Append("
stringBuilder.Append("
stringBuilder.Append("
using (SqlConnection stud1 = studPortConn.GetStudPortCon())
{
stud1.Open();
da.SelectCommand = new SqlCommand("SELECT moduleID,menuDesc,menuPath FROM Menu WHERE moduleID='" + modID + "'", stud1);
SqlDataReader sc1 = da.SelectCommand.ExecuteReader();
if (sc1.HasRows)
{
while (sc1.Read())
{
stringBuilder.AppendFormat("
}
}
stringBuilder.Append("
stringBuilder.Append("
stringBuilder.Append("
// }
}
}
if (stringBuilder.Length > 0)
{
divtajukText.Controls.Add(new Literal { Text = stringBuilder.ToString() });
divtajukText.Visible = true;
}
divtajukText.Controls.Add(new LiteralControl("
"));
}
}
}
Rupali ShindePosted Nov 15, 2015, 11:14 PM