Click here to Skip to main content
15,911,306 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Can't resolve for a while. Link button in a datalist Pin
N a v a n e e t h4-Jan-09 15:15
N a v a n e e t h4-Jan-09 15:15 
GeneralRe: Can't resolve for a while. Link button in a datalist Pin
Albert834-Jan-09 15:18
Albert834-Jan-09 15:18 
GeneralRe: Can't resolve for a while. Link button in a datalist Pin
N a v a n e e t h4-Jan-09 15:26
N a v a n e e t h4-Jan-09 15:26 
GeneralRe: Can't resolve for a while. Link button in a datalist Pin
Not Active4-Jan-09 15:26
mentorNot Active4-Jan-09 15:26 
QuestionRe: Can't resolve for a while. Link button in a datalist Pin
Albert834-Jan-09 15:28
Albert834-Jan-09 15:28 
AnswerRe: Can't resolve for a while. Link button in a datalist Pin
Not Active4-Jan-09 15:31
mentorNot Active4-Jan-09 15:31 
GeneralRe: Can't resolve for a while. Link button in a datalist Pin
N a v a n e e t h4-Jan-09 15:30
N a v a n e e t h4-Jan-09 15:30 
GeneralRe: Can't resolve for a while. Link button in a datalist Pin
Albert834-Jan-09 15:39
Albert834-Jan-09 15:39 
Actually I am far from a beginner. I tried the data list handling as follows but it only gets the first row everytime, and starts over. it never goes to the next record. I know the problem but don't know the solution.

What kind of template should I be using? Data List is a template.
Thanks again.

protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
{

foreach (DataListItem dlItem in DataList1.Items)
{
LinkButton lb = (LinkButton)dlItem.FindControl("deleteBtn");

using (SqlConnection sqlConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
{
sqlConnection.Open();
SqlCommand cmdRFullName = new SqlCommand("SELECT username FROM mediaComments ", sqlConnection);
SqlDataReader dr = cmdRFullName.ExecuteReader();
if (dr.HasRows)
{
while (dr.Read())
{
if (Session["user_name"] != dr["username"])

lb.Visible = false;
Response.Write("dr" + dr[0] + "<br />");
}
}
}
}

<asp:DataList DataKeyField="commentId" OnDeleteCommand="DataList1_DeleteCommand" ID="DataList1" RepeatLayout="table" runat="server" DataSourceID="ChalkDL">
<ItemTemplate>
<table width="500" cellspacing="0" cellpadding="5" border="0">
<tr>
<td><asp:LinkButton ID="lnkUser" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "username") %>'></asp:LinkButton></td>
</tr>
<tr>

<td colspan="1" width="240px" style="width: 240px; color: Black;" align="left" ><%# DataBinder.Eval(Container.DataItem, "commentText") %></td>
<td style="padding-top: 10px; color: Black;" align="right"><%# String.Format("{0:hh}:{0:mm}{0:tt} {0:MM}.{0:dd}.{0:yy}", DataBinder.Eval(Container.DataItem, "datePosted"))%></td>

</tr>
<tr>
<td style="padding-top: 10px;"><asp:LinkButton OnCommand="LinkButtonCommand" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "username") %>' OnClientClick="return confirm('Are you sure you want to delete your post?');" Visible='<%# visible %>' runat="server" CommandName="delete" ID="deleteBtn" Text="Delete"></asp:LinkButton></td>
</tr>
<tr>
<td colspan="2"><hr /></td>
</tr>
</table>

</ItemTemplate>
</asp:DataList>
GeneralRe: Can't resolve for a while. Link button in a datalist Pin
Not Active4-Jan-09 15:55
mentorNot Active4-Jan-09 15:55 
GeneralRe: Can't resolve for a while. Link button in a datalist Pin
Albert834-Jan-09 16:07
Albert834-Jan-09 16:07 
GeneralRe: Can't resolve for a while. Link button in a datalist Pin
Not Active4-Jan-09 16:41
mentorNot Active4-Jan-09 16:41 
GeneralRe: Can't resolve for a while. Link button in a datalist Pin
Albert834-Jan-09 16:53
Albert834-Jan-09 16:53 
GeneralRe: Can't resolve for a while. Link button in a datalist Pin
Not Active4-Jan-09 17:20
mentorNot Active4-Jan-09 17:20 
GeneralRe: Can't resolve for a while. Link button in a datalist Pin
Albert834-Jan-09 17:54
Albert834-Jan-09 17:54 
GeneralRe: Can't resolve for a while. Link button in a datalist Pin
N a v a n e e t h4-Jan-09 16:55
N a v a n e e t h4-Jan-09 16:55 
GeneralRe: Can't resolve for a while. Link button in a datalist Pin
Not Active4-Jan-09 17:16
mentorNot Active4-Jan-09 17:16 
GeneralRe: Can't resolve for a while. Link button in a datalist Pin
Albert834-Jan-09 17:21
Albert834-Jan-09 17:21 
GeneralRe: Can't resolve for a while. Link button in a datalist Pin
Not Active4-Jan-09 17:30
mentorNot Active4-Jan-09 17:30 
GeneralRe: Can't resolve for a while. Link button in a datalist Pin
Albert834-Jan-09 17:33
Albert834-Jan-09 17:33 
Questionsession timeout problem Pin
nour1234-Jan-09 6:43
nour1234-Jan-09 6:43 
AnswerRe: session timeout problem Pin
kaushal_prabhakar4-Jan-09 19:46
kaushal_prabhakar4-Jan-09 19:46 
QuestionConverting vc++.net code to c# Pin
anveshvm3-Jan-09 22:21
anveshvm3-Jan-09 22:21 
AnswerRe: Converting vc++.net code to c# Pin
N a v a n e e t h3-Jan-09 22:49
N a v a n e e t h3-Jan-09 22:49 
GeneralRe: Converting vc++.net code to c# Pin
anveshvm3-Jan-09 22:59
anveshvm3-Jan-09 22:59 
GeneralRe: Converting vc++.net code to c# Pin
N a v a n e e t h3-Jan-09 23:14
N a v a n e e t h3-Jan-09 23:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.