C# : ASP.NET repeater not showing all the data
P!nk
1
Reputation point
ASPX:
<asp:Repeater ID="RepDetails" runat="server">
<HeaderTemplate>
<table style=" border:1px solid white; width:100%;" cellpadding="0">
<tr style="background-color:darkgray; color:White">
<td colspan="7">
</td>
</tr>
<tr style="background-color:darkgray; color:White">
<td colspan="1">
<b>#</b>
</td>
<td colspan="4">
<b>Section 1</b>
</td>
<td colspan="1">
<b>Strongly Agree</b>
</td>
<td colspan="1">
<b>Agree</b>
</td>
<td colspan="1">
<b>Neutral</b>
</td>
<td colspan="1">
<b>Disagree</b>
</td>
<td colspan="1">
<b>Strongly Disagree</b>
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:#EBEFF0">
<td colspan="1">
<asp:Label ID="lblRowNumber" Text='<%# Container.ItemIndex + 1 %>' runat="server" />
<asp:Label ID="Label1" runat="server" Text=" * "/>
<asp:Label ID="HiddenLabel" runat="server" Text=""/>
</td>
<td colspan="4">
<asp:Label ID="LabelID" runat="server" Font-Bold="true" Visible="false" ForeColor="#ED700E" Text='<%#Eval("ID") %>'/>
<asp:Label ID="lblComment" runat="server" ForeColor="#ED700E" Text='<%#Eval("Question") %>'/>
</td>
<%--ForeColor="DeepPink" / ForeColor="SteelBlue" link color--%>
<%--<td colspan="1">
<asp:Label ID="lblUser" runat="server" Font-Bold="true" ForeColor="#ED700E" Text='<%#Eval("sectionNo") %>'/></td>--%>
<td colspan="1" >
<asp:RadioButton ID="R1" runat="server" style="margin-left:50%;" GroupName='<%#Eval("ID") %>' /></td>
<td colspan="1">
<asp:RadioButton ID="R2" runat="server" style="margin-left:50%;" GroupName='<%#Eval("ID") %>' /></td>
<td colspan="1">
<asp:RadioButton ID="R3" runat="server" style="margin-left:50%;" GroupName='<%#Eval("ID") %>' /></td>
<td colspan="1">
<asp:RadioButton ID="R4" runat="server" style="margin-left:50%;" GroupName='<%#Eval("ID") %>' /></td>
<td colspan="1">
<asp:RadioButton ID="R5" runat="server" style="margin-left:50%;" GroupName='<%#Eval("ID") %>' /></td>
<%--<td colspan="1">
<asp:RadioButton ID="R6" runat="server" /></td>--%>
<%--<td colspan="1">--%>
<%--<asp:LinkButton ID="lnkEdit" Text="Edit" runat="server" commandname="Click"
OnClientClick="OnUpdateText"
CommandArgument='<%#DataBinder.Eval(Container.DataItem,"surveyID") %>' />--%>
<%-- <asp:HyperLink ID="lnkEdit" runat="server" ForeColor="Blue" NavigateUrl='<%# "EditPublishSurvey.aspx?sid=" + Eval("surveyID")%>'>Edit</asp:HyperLink>
<br />
<asp:LinkButton ID="lnkUpdate" Text="Update" runat="server" Visible="false" />
<asp:LinkButton ID="lnkCancel" Text="Cancel" runat="server" Visible="false" />
<asp:LinkButton ID="lnkDelete" Text="Delete" runat="server" Visible="false" ForeColor="DeepPink" OnClientClick="return confirm('Do you want to delete this Question?');" />
</td>
--%>
</tr>
<tr style="background-color:#EBEFF0; border:1px solid gray;"></tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
C#:
protected void BindRepeaterData()
{
string com34 = "select * from tblQuestionsWithAnswers where surveyID = '" + DropDownListSurveyNotSolved.SelectedItem.Text + "' And questionTypeID = 1";
using (SqlConnection con3 = new SqlConnection(StrSqlDbConStringTT))
{
using (SqlCommand cmd1 = new SqlCommand(com34, con3))
{
con3.Open();
//count1 = (int)cmd3.ExecuteScalar();
//count = count1;
//Label11.Text = count1.ToString();
if (cmd1.ExecuteScalar() == null)
{
divHeader.Visible = false;
divRepeater.Visible = false;
}
else
{
//Show the survey divs
divHeader.Visible = true;
divRepeater.Visible = true;
//where questionID = '" + TextBoxSurveyName.Text + "'
SqlCommand cmd11 = new SqlCommand("select * from tblQuestionsWithAnswers where surveyID = '" + DropDownListSurveyNotSolved.SelectedItem.Text + "' And questionTypeID = 1", con);
DataSet ds11 = new DataSet();
SqlDataAdapter da11 = new SqlDataAdapter(cmd11);
da11.Fill(ds11);
RepDetails.DataSource = ds11;
RepDetails.DataBind();
}
}
}
}
ScreenShot:
]1
section 1 is not showing
Does anyone know the reason why its not showing ?
Developer technologies ASP.NET Other
3,597 questions
Developer technologies C#
11,570 questions
Sign in to answer