SetLiteralText

public static void SetLiteralText(this ListViewItem item, string literalName, string text)
{
  Literal literal = (Literal)item.FindControl(literalName);
  literal.Text = text;
}
Example:
void ListView_ItemDataBound(object sender,
                            ListViewItemEventArgs e)
{
  e.Item.SetLiteralText("RandomLiteral",
                        "Text For Literal");
}

Description

Often you have to set the text of lots of literal when databinding a ListView control in ASP.Net. This method lets you write that in one line.

Details

Double click on the code to select all.

 

;