Click here to Skip to main content
15,914,111 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Functionlity of viewstate Pin
DIMPLE_R29-Jun-06 20:49
DIMPLE_R29-Jun-06 20:49 
GeneralClickety Police Pin
Colin Angus Mackay29-Jun-06 21:38
Colin Angus Mackay29-Jun-06 21:38 
QuestionMSN Messenger 7.5 Pin
clatterbucket29-Jun-06 20:04
clatterbucket29-Jun-06 20:04 
QuestionHow to create feedbackform in ASP.Net using C# Pin
somya12229-Jun-06 19:45
somya12229-Jun-06 19:45 
AnswerRe: How to create feedbackform in ASP.Net using C# Pin
Amit Agarrwal29-Jun-06 20:19
Amit Agarrwal29-Jun-06 20:19 
GeneralRe: How to create feedbackform in ASP.Net using C# Pin
Murali xten8-May-13 21:15
professionalMurali xten8-May-13 21:15 
AnswerRe: How to create feedbackform in ASP.Net using C# Pin
Muhammad Chitrali30-Jun-06 3:48
Muhammad Chitrali30-Jun-06 3:48 
Questionconvert the site info into Xml format Pin
Amit Agarrwal29-Jun-06 19:08
Amit Agarrwal29-Jun-06 19:08 
QuestionTime Converting From Database Pin
varshavmane29-Jun-06 19:02
varshavmane29-Jun-06 19:02 
QuestionCreating Excel file from dataset data [modified] Pin
Dhruvil29-Jun-06 18:21
Dhruvil29-Jun-06 18:21 
AnswerRe: Creating Excel file from dataset data [modified] Pin
ketankumar29-Jun-06 20:17
ketankumar29-Jun-06 20:17 
GeneralRe: Creating Excel file from dataset data Pin
Dhruvil30-Jun-06 2:54
Dhruvil30-Jun-06 2:54 
GeneralRe: Creating Excel file from dataset data Pin
ketankumar30-Jun-06 3:10
ketankumar30-Jun-06 3:10 
GeneralRe: Creating Excel file from dataset data Pin
Dhruvil30-Jun-06 5:34
Dhruvil30-Jun-06 5:34 
GeneralRe: Creating Excel file from dataset data Pin
ketankumar1-Jul-06 23:39
ketankumar1-Jul-06 23:39 
Questionproblem with inheriring a page Pin
sishya29-Jun-06 15:31
sishya29-Jun-06 15:31 
AnswerRe: problem with inheriring a page Pin
minhpc_bk29-Jun-06 17:06
minhpc_bk29-Jun-06 17:06 
AnswerRe: problem with inheriring a page Pin
Guffa29-Jun-06 19:02
Guffa29-Jun-06 19:02 
GeneralBut the placeholder control is declared in the code behind class also . Pin
sishya29-Jun-06 19:15
sishya29-Jun-06 19:15 
AnswerRe: But the placeholder control is declared in the code behind class also . Pin
Guffa29-Jun-06 19:40
Guffa29-Jun-06 19:40 
QuestionManage a GridView's HyperLinkField column's width? [modified] Pin
-Dr_X-29-Jun-06 10:24
-Dr_X-29-Jun-06 10:24 
Scenario: I was using Template columns with ImageButtons with no problem controlling the columns' width. However template columns are not allowed when 'EnableSortingAndPagingCallbacks="True"'.
Original html code:
<asp:TemplateField ItemStyle-Width="22px">
  <ItemTemplate>
    <asp:ImageButton ID="imbView" runat="server" ImageUrl="~/Images/ViewSearch.gif"  />
  </ItemTemplate>
</asp:TemplateField>         
<asp:TemplateField ItemStyle-Width="22px">
  <ItemTemplate>
    <asp:ImageButton ID="imgEdit" runat="server" ImageUrl="~/Images/Edit.gif"  />
  </ItemTemplate>
</asp:TemplateField> 
<asp:TemplateField ItemStyle-Width="22px">
  <ItemTemplate>
    <asp:ImageButton ID="imgDelete" runat="server" ImageUrl="~/Images/Delete.gif"  />
  </ItemTemplate>
</asp:TemplateField>                       
<asp:TemplateField ItemStyle-Width="22px">
  <ItemTemplate>
    <asp:ImageButton ID="imgPrint" runat="server" ImageUrl="~/Images/Print.gif"  />
  </ItemTemplate>
</asp:TemplateField>
So I replaced the template columns with HyperLinkField. Then in the onRowDataBound event in the code-behind, I set the images to the respective links.
</asp:HyperLinkField DataNavigateUrlFormatString="~/Invoices/Invoice.aspx?id={0}&Readonly" DataNavigateUrlFields="InvoiceID" ItemStyle-Width="20px" />
</asp:HyperLinkField DataNavigateUrlFormatString="~/Invoices/Invoice.aspx?id={0}&Edit" DataNavigateUrlFields="InvoiceID" />
</asp:HyperLinkField DataNavigateUrlFormatString="~/Reports/Reports.aspx?DeleteFromSomeWhere" DataNavigateUrlFields="InvoiceID" />
</asp:HyperLinkField DataNavigateUrlFormatString="~/Reports/Reports.aspx?id={0}" DataNavigateUrlFields="InvoiceID" />
public void dgData_onRowDataBound(Object src, GridViewRowEventArgs e)
{
  if (e.Row.RowType == DataControlRowType.DataRow)
  {
    DataRowView row = (DataRowView)e.Row.DataItem;
    HyperLink link = (HyperLink)e.Row.Cells[0].Controls[0];
    if (!(link == null))
    {
      link.ImageUrl = "~/Images/ViewSearch.gif";
      link.ToolTip = "Print";
    }
    link = (HyperLink)e.Row.Cells[1].Controls[0];
    if (!(link == null))
    {
      link.ImageUrl = "~/Images/Edit.gif";
      link.ToolTip = "Print";
    }
    link = (HyperLink)e.Row.Cells[2].Controls[0];
    if (!(link == null))
    {
      link.ImageUrl = "~/Images/Delete.gif";
      link.ToolTip = "Delete Invoice";
      link.Attributes.Add("onclick", "javascript: alert('works'); return false;");
    }
    link = (HyperLink)e.Row.Cells[3].Controls[0];
    if (!(link == null))
    {
      link.ImageUrl = "~/Images/Print.gif";
      link.ToolTip = "Print Invoice";
    }
  }
}
After the changes, which fixes the EnableSortingAndPagingCallbacks problems, the column images (ViewSearch, Edit, Delete & Print) are spaced apart instead of nicely next to each other. I have tried the following variations with no luck.
        if (!(link==null))
        {
          link.ImageUrl = "~/Images/ViewSearch.gif";
          link.ToolTip="Print";
          link.Width = System.Web.UI.WebControls.Unit.Pixel(20);
          e.Row.Cells[0].Style.Add("max-width", "20px");
          e.Row.Cells[0].Style.Add(System.Web.UI.HtmlTextWriterStyle.Width, "20px");
          e.Row.Cells[0].Width = System.Web.UI.WebControls.Unit.Pixel(20);
        }
and also
  <asp:HyperLinkField ... ItemStyle-Width="20px" ControlStyle-Width="20px"/>

Thanks in advance,
Michael

I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious.
Vince Lombardi (1913-1970)

-- modified at 17:18 Thursday 29th June, 2006
AnswerRe: Manage a GridView's HyperLinkField column's width? Pin
minhpc_bk29-Jun-06 17:02
minhpc_bk29-Jun-06 17:02 
GeneralRe: Manage a GridView's HyperLinkField column's width? Pin
-Dr_X-5-Jul-06 7:09
-Dr_X-5-Jul-06 7:09 
QuestionSession [modified] Pin
kirthikirthi29-Jun-06 9:04
kirthikirthi29-Jun-06 9:04 
AnswerRe: Session Pin
Guffa29-Jun-06 11:44
Guffa29-Jun-06 11:44 

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.