473,322 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Centering button in a datagrid column

I am trying to center a button in a datagrid column in asp.net and it
doesn't seem to work.

I have the following:

<asp:TemplateColumn ItemStyle-Width="10%"
ItemStyle-HorizontalAlign="Center">
<FooterTemplate>
<asp:LinkButton CommandName="Insert" Text="<img
src='..\images\Add.gif'border='0'>" ID="btnAdd" Runat="server" />
</FooterTemplate>
<ItemTemplate>
<asp:LinkButton CommandName="Delete" Text="<img
src='..\images\Delete.gif'border='0'>" ID="btnDel" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>

I had thought the ItemStyle-HorizontalAlign="Center" would center whatever
was in the column - which translates to <td></td>, but it doesn't seem to do
that.

Is there a way to do this?

Thanks,

Tom
Nov 18 '05 #1
16 1653
What i do is just design CSS...(And its re usable)
And add it like "ItemStyle-CssClass="YourCSSClass"
GDluck
Patrick

"tshad" wrote:
I am trying to center a button in a datagrid column in asp.net and it
doesn't seem to work.

I have the following:

<asp:TemplateColumn ItemStyle-Width="10%"
ItemStyle-HorizontalAlign="Center">
<FooterTemplate>
<asp:LinkButton CommandName="Insert" Text="<img
src='..\images\Add.gif'border='0'>" ID="btnAdd" Runat="server" />
</FooterTemplate>
<ItemTemplate>
<asp:LinkButton CommandName="Delete" Text="<img
src='..\images\Delete.gif'border='0'>" ID="btnDel" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>

I had thought the ItemStyle-HorizontalAlign="Center" would center whatever
was in the column - which translates to <td></td>, but it doesn't seem to do
that.

Is there a way to do this?

Thanks,

Tom

Nov 18 '05 #2
"Patrick.O.Ige" <Pa*********@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com...
What i do is just design CSS...(And its re usable)
And add it like "ItemStyle-CssClass="YourCSSClass"
I tried that, but I can't seem to find where you say to center what is
inside the cell. There is text-align:center, and vertical:align but no
horizontal-align. ItemStyle-HorizontalAlign="Center" is what is supposed to
center align the contents of the cell. Not sure why that doesn't work.

Thanks,

Tom GDluck
Patrick

"tshad" wrote:
I am trying to center a button in a datagrid column in asp.net and it
doesn't seem to work.

I have the following:

<asp:TemplateColumn ItemStyle-Width="10%"
ItemStyle-HorizontalAlign="Center" >
<FooterTemplate>
<asp:LinkButton CommandName="Insert" Text="<img
src='..\images\Add.gif'border='0'>" ID="btnAdd" Runat="server" />
</FooterTemplate>
<ItemTemplate>
<asp:LinkButton CommandName="Delete" Text="<img
src='..\images\Delete.gif'border='0'>" ID="btnDel" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>

I had thought the ItemStyle-HorizontalAlign="Center" would center
whatever
was in the column - which translates to <td></td>, but it doesn't seem to
do
that.

Is there a way to do this?

Thanks,

Tom

Nov 18 '05 #3
Hi,
u can use ItemStyle-CssClass="YourCSSClass"
I mean create a Cascading style and then add it to the
ItemStyle-CssClass!Have u done that?
Or post ur code where u can't center it.
Patrick


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #4
"naija naija" <pa*********@crazyjohns.com.au> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi,
u can use ItemStyle-CssClass="YourCSSClass"
I mean create a Cascading style and then add it to the
ItemStyle-CssClass!Have u done that?
Or post ur code where u can't center it.
I posted it in the first message.

Here is the whole datagrid:

************************************************** *********************************
<asp:DataGrid visible="False"
border=1
id="DataGrid1"
runat="server"
Width="400px"
Height="79px"
AutoGenerateColumns="False"
GridLines="None"
ShowFooter="true"
onItemDataBound="DataGrid1_ItemDataBound"
OnItemCommand="DataInsert"
onEditCommand="DataEdit"
onCancelCommand="DataCancel"
onUpdateCommand="DataUpdate">
<AlternatingItemStyle BorderWidth="0px" BorderStyle="None"
BorderColor="White" BackColor="linen"></AlternatingItemStyle>
<HeaderStyle Font-Bold="True"
BackColor="#6699cc"></HeaderStyle>
<Columns>
<asp:TemplateColumn HeaderText="Answer">
<ItemTemplate>
<asp:Label id="lblAnswer" runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.Answer") %>'>
</asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox id="txtAnswerFooter"
runat="server"></asp:TextBox>
</FooterTemplate>
<EditItemTemplate>
<asp:textbox id="txtAnswer" runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.Answer") %>'>
</asp:textbox>
</EditItemTemplate>
</asp:templateColumn>
<asp:TemplateColumn visible="false">
<ItemTemplate>
<asp:Label id="lblPositionID" runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.PositionID") %>'>
</asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:Label id="lblPositionIDFooter" runat="server">
</asp:Label>
</FooterTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn visible="false">
<ItemTemplate>
<asp:Label id="lblQuestionUnique" runat="server"
Text='<%# DataBinder.Eval(Container, "DataItem.QuestionUnique") %>'>
</asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:Label id="lblQuestionUniqueFooter" runat="server">
</asp:Label>
</FooterTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn visible="false">
<ItemTemplate>
<asp:Label id="lblAnswerUnique" runat="server"
Text='<%# DataBinder.Eval(Container, "DataItem.AnswerUnique") %>'>
</asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:Label id="lblAnswerUniqueFooter" runat="server">
</asp:Label>
</FooterTemplate>
</asp:TemplateColumn>
<asp:EditCommandColumn EditText="<img
src='..\images\Edit.png'border='0' id='textbox1'>" visible="true"
ItemStyle-Width="10%"
ButtonType="LinkButton"
UpdateText="<img src='..\images\update.png'
border='0'>" CancelText="<img src='..\images\Cancel.png' border='0'>" />
<asp:TemplateColumn ItemStyle-Width="10%"
ItemStyle-CssClass="tdCenter" >
<FooterTemplate>
<asp:LinkButton CommandName="Insert" Text="<img
src='..\images\Add.gif'border='0'>" ID="btnAdd" Runat="server" />
</FooterTemplate>
<ItemTemplate>
<asp:LinkButton CommandName="Delete" Text="<img
src='..\images\Delete.gif'border='0'>" ID="btnDel" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
************************************************** ***********************************

Here is the template code that has the ItemStyle-CssClass="tdCenter":
************************************************** ****************************************
<asp:TemplateColumn ItemStyle-Width="10%"
ItemStyle-CssClass="tdCenter" >
<FooterTemplate>
<asp:LinkButton CommandName="Insert" Text="<img
src='..\images\Add.gif'border='0'>" ID="btnAdd" Runat="server" />
</FooterTemplate>
<ItemTemplate>
<asp:LinkButton CommandName="Delete" Text="<img
src='..\images\Delete.gif'border='0'>" ID="btnDel" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
************************************************** *****************************************

The css code:

..tdCenter {
text-align:center;
}

I found that the footer is the only problem. The normal grid rows work
fine. The last column will center for either ItemStyle-CssClass="tdCenter"
or for ItemStyle-Horizontal="center", but not the footer.

Tom.
Patrick


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #5
Tom,
U were missing something i guess i tried ur code and i added CCS to
LinkButton:-
<asp:LinkButton CommandName="Insert" CssClass="tdCenter" text="<img
src='..\images\Add.gif'border='0'>"ID="btnAdd" Runat="server" />
But i guess it wasn't the problem which i taught it was.
I later found out u that the CSS u posted had double dots like so:-
...tdCenter {
text-align:center;
}
so i changed it to(WITH one DOT before "tdCenter" :-
..tdCenter {
text-align:center;
}

So adding CSS to "<asp:TemplateColumn ItemStyle-Width="10%"
ItemStyle-CssClass="tdCenter">" was good and u were doing the right thing but
u added to much DOTS:):)

Hope this helps..and let me know if it worked!
Patrick

"tshad" wrote:
"naija naija" <pa*********@crazyjohns.com.au> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi,
u can use ItemStyle-CssClass="YourCSSClass"
I mean create a Cascading style and then add it to the
ItemStyle-CssClass!Have u done that?
Or post ur code where u can't center it.


I posted it in the first message.

Here is the whole datagrid:

************************************************** *********************************
<asp:DataGrid visible="False"
border=1
id="DataGrid1"
runat="server"
Width="400px"
Height="79px"
AutoGenerateColumns="False"
GridLines="None"
ShowFooter="true"
onItemDataBound="DataGrid1_ItemDataBound"
OnItemCommand="DataInsert"
onEditCommand="DataEdit"
onCancelCommand="DataCancel"
onUpdateCommand="DataUpdate">
<AlternatingItemStyle BorderWidth="0px" BorderStyle="None"
BorderColor="White" BackColor="linen"></AlternatingItemStyle>
<HeaderStyle Font-Bold="True"
BackColor="#6699cc"></HeaderStyle>
<Columns>
<asp:TemplateColumn HeaderText="Answer">
<ItemTemplate>
<asp:Label id="lblAnswer" runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.Answer") %>'>
</asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox id="txtAnswerFooter"
runat="server"></asp:TextBox>
</FooterTemplate>
<EditItemTemplate>
<asp:textbox id="txtAnswer" runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.Answer") %>'>
</asp:textbox>
</EditItemTemplate>
</asp:templateColumn>
<asp:TemplateColumn visible="false">
<ItemTemplate>
<asp:Label id="lblPositionID" runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.PositionID") %>'>
</asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:Label id="lblPositionIDFooter" runat="server">
</asp:Label>
</FooterTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn visible="false">
<ItemTemplate>
<asp:Label id="lblQuestionUnique" runat="server"
Text='<%# DataBinder.Eval(Container, "DataItem.QuestionUnique") %>'>
</asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:Label id="lblQuestionUniqueFooter" runat="server">
</asp:Label>
</FooterTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn visible="false">
<ItemTemplate>
<asp:Label id="lblAnswerUnique" runat="server"
Text='<%# DataBinder.Eval(Container, "DataItem.AnswerUnique") %>'>
</asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:Label id="lblAnswerUniqueFooter" runat="server">
</asp:Label>
</FooterTemplate>
</asp:TemplateColumn>
<asp:EditCommandColumn EditText="<img
src='..\images\Edit.png'border='0' id='textbox1'>" visible="true"
ItemStyle-Width="10%"
ButtonType="LinkButton"
UpdateText="<img src='..\images\update.png'
border='0'>" CancelText="<img src='..\images\Cancel.png' border='0'>" />
<asp:TemplateColumn ItemStyle-Width="10%"
ItemStyle-CssClass="tdCenter" >
<FooterTemplate>
<asp:LinkButton CommandName="Insert" Text="<img
src='..\images\Add.gif'border='0'>" ID="btnAdd" Runat="server" />
</FooterTemplate>
<ItemTemplate>
<asp:LinkButton CommandName="Delete" Text="<img
src='..\images\Delete.gif'border='0'>" ID="btnDel" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
************************************************** ***********************************

Here is the template code that has the ItemStyle-CssClass="tdCenter":
************************************************** ****************************************
<asp:TemplateColumn ItemStyle-Width="10%"
ItemStyle-CssClass="tdCenter" >
<FooterTemplate>
<asp:LinkButton CommandName="Insert" Text="<img
src='..\images\Add.gif'border='0'>" ID="btnAdd" Runat="server" />
</FooterTemplate>
<ItemTemplate>
<asp:LinkButton CommandName="Delete" Text="<img
src='..\images\Delete.gif'border='0'>" ID="btnDel" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
************************************************** *****************************************

The css code:

..tdCenter {
text-align:center;
}

I found that the footer is the only problem. The normal grid rows work
fine. The last column will center for either ItemStyle-CssClass="tdCenter"
or for ItemStyle-Horizontal="center", but not the footer.

Tom.
Patrick


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 18 '05 #6
Tom,
U were missing something i guess i tried ur code and i added CCS to
LinkButton:-
<asp:LinkButton CommandName="Insert" CssClass="tdCenter" text="<img
src='..\images\Add.gif'border='0'>"ID="btnAdd" Runat="server" />
But i guess it wasn't the problem which i taught it was.
I later found out u that the CSS u posted had double dots like so:-
..tdCenter {
text-align:center;
}
so i changed it to(WITH one DOT before "tdCenter" :-
.tdCenter {
text-align:center;
}

So adding CSS to "<asp:TemplateColumn ItemStyle-Width="10%"
ItemStyle-CssClass="tdCenter">" was good and u were doing the right
thing but u added to much DOTS:):)

Hope this helps..and let me know if it worked!
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #7
"Patrick.O.Ige" <Pa*********@discussions.microsoft.com> wrote in message
news:F6**********************************@microsof t.com...
Tom,
U were missing something i guess i tried ur code and i added CCS to
LinkButton:-
<asp:LinkButton CommandName="Insert" CssClass="tdCenter" text="<img
src='..\images\Add.gif'border='0'>"ID="btnAdd" Runat="server" />
But i guess it wasn't the problem which i taught it was.
I later found out u that the CSS u posted had double dots like so:-
..tdCenter {
text-align:center;
}
so i changed it to(WITH one DOT before "tdCenter" :-
.tdCenter {
text-align:center;
}

So adding CSS to "<asp:TemplateColumn ItemStyle-Width="10%"
ItemStyle-CssClass="tdCenter">" was good and u were doing the right thing
but
u added to much DOTS:):)
You're right. My mistake. But the .css file had it correct, I just added
an extra dot for some reason in the post.

It still doesn't work. But only for the Footer, as I mentioned. It does
work for the ItemTemplate.

Thanks,

Tom.
Hope this helps..and let me know if it worked!
Patrick

"tshad" wrote:
"naija naija" <pa*********@crazyjohns.com.au> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
> Hi,
> u can use ItemStyle-CssClass="YourCSSClass"
> I mean create a Cascading style and then add it to the
> ItemStyle-CssClass!Have u done that?
> Or post ur code where u can't center it.


I posted it in the first message.

Here is the whole datagrid:

************************************************** *********************************
<asp:DataGrid visible="False"
border=1
id="DataGrid1"
runat="server"
Width="400px"
Height="79px"
AutoGenerateColumns="False"
GridLines="None"
ShowFooter="true"
onItemDataBound="DataGrid1_ItemDataBound"
OnItemCommand="DataInsert"
onEditCommand="DataEdit"
onCancelCommand="DataCancel"
onUpdateCommand="DataUpdate">
<AlternatingItemStyle BorderWidth="0px"
BorderStyle="None"
BorderColor="White" BackColor="linen"></AlternatingItemStyle>
<HeaderStyle Font-Bold="True"
BackColor="#6699cc"></HeaderStyle>
<Columns>
<asp:TemplateColumn HeaderText="Answer">
<ItemTemplate>
<asp:Label id="lblAnswer" runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.Answer") %>'>
</asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox id="txtAnswerFooter"
runat="server"></asp:TextBox>
</FooterTemplate>
<EditItemTemplate>
<asp:textbox id="txtAnswer" runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.Answer") %>'>
</asp:textbox>
</EditItemTemplate>
</asp:templateColumn>
<asp:TemplateColumn visible="false">
<ItemTemplate>
<asp:Label id="lblPositionID" runat="server"
Text='<%#
DataBinder.Eval(Container, "DataItem.PositionID") %>'>
</asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:Label id="lblPositionIDFooter" runat="server">
</asp:Label>
</FooterTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn visible="false">
<ItemTemplate>
<asp:Label id="lblQuestionUnique" runat="server"
Text='<%# DataBinder.Eval(Container, "DataItem.QuestionUnique") %>'>
</asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:Label id="lblQuestionUniqueFooter"
runat="server">
</asp:Label>
</FooterTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn visible="false">
<ItemTemplate>
<asp:Label id="lblAnswerUnique" runat="server"
Text='<%# DataBinder.Eval(Container, "DataItem.AnswerUnique") %>'>
</asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:Label id="lblAnswerUniqueFooter"
runat="server">
</asp:Label>
</FooterTemplate>
</asp:TemplateColumn>
<asp:EditCommandColumn EditText="<img
src='..\images\Edit.png'border='0' id='textbox1'>" visible="true"
ItemStyle-Width="10%"
ButtonType="LinkButton"
UpdateText="<img src='..\images\update.png'
border='0'>" CancelText="<img src='..\images\Cancel.png' border='0'>" />
<asp:TemplateColumn ItemStyle-Width="10%"
ItemStyle-CssClass="tdCenter" >
<FooterTemplate>
<asp:LinkButton CommandName="Insert" Text="<img
src='..\images\Add.gif'border='0'>" ID="btnAdd" Runat="server" />
</FooterTemplate>
<ItemTemplate>
<asp:LinkButton CommandName="Delete" Text="<img
src='..\images\Delete.gif'border='0'>" ID="btnDel" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
************************************************** ***********************************

Here is the template code that has the ItemStyle-CssClass="tdCenter":
************************************************** ****************************************
<asp:TemplateColumn ItemStyle-Width="10%"
ItemStyle-CssClass="tdCenter" >
<FooterTemplate>
<asp:LinkButton CommandName="Insert" Text="<img
src='..\images\Add.gif'border='0'>" ID="btnAdd" Runat="server" />
</FooterTemplate>
<ItemTemplate>
<asp:LinkButton CommandName="Delete" Text="<img
src='..\images\Delete.gif'border='0'>" ID="btnDel" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
************************************************** *****************************************

The css code:

..tdCenter {
text-align:center;
}

I found that the footer is the only problem. The normal grid rows work
fine. The last column will center for either
ItemStyle-CssClass="tdCenter"
or for ItemStyle-Horizontal="center", but not the footer.

Tom.
> Patrick
>
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!


Nov 18 '05 #8
Hi Tom,
Well i found another solution for you (What i did was wrap the
linkButton in the footer around the DIV element.
So what u can do to have a CLEAN code is just to put the DIV up in your
CSS (the working code below):-
Hope this helps!
Enjoy
Patrick

<asp:TemplateColumn ItemStyle-Width="10%" ItemStyle-CssClass="tdCenter">
<FooterTemplate>
<div align="center">
<asp:LinkButton CommandName="Insert" text="<img
src='..\images\Add.gif'border='0'>" ID="btnAdd" Runat="server" />
</div>
</FooterTemplate>
<ItemTemplate>
<asp:LinkButton CommandName="Delete" text="<img
src='..\images\Delete.gif'border='0'>" ID="btnDel"
Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #9
Hi Tom,
Did the solution work?
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #10
"naija naija" <pa*********@crazyjohns.com.au> wrote in message
news:ud**************@TK2MSFTNGP10.phx.gbl...
Hi Tom,
Well i found another solution for you (What i did was wrap the
linkButton in the footer around the DIV element.
So what u can do to have a CLEAN code is just to put the DIV up in your
CSS (the working code below):-
That did the job!

I am surprised the other options didn't - as that was what they were there
for.

Thanks,

Tom Hope this helps!
Enjoy
Patrick

<asp:TemplateColumn ItemStyle-Width="10%" ItemStyle-CssClass="tdCenter">
<FooterTemplate>
<div align="center">
<asp:LinkButton CommandName="Insert" text="<img
src='..\images\Add.gif'border='0'>" ID="btnAdd" Runat="server" />
</div>
</FooterTemplate>
<ItemTemplate>
<asp:LinkButton CommandName="Delete" text="<img
src='..\images\Delete.gif'border='0'>" ID="btnDel"
Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #11
Hi Tom,
Did you get the working solution i sent to you?
Let me know!
Patrick

"naija naija" wrote:
Tom,
U were missing something i guess i tried ur code and i added CCS to
LinkButton:-
<asp:LinkButton CommandName="Insert" CssClass="tdCenter" text="<img
src='..\images\Add.gif'border='0'>"ID="btnAdd" Runat="server" />
But i guess it wasn't the problem which i taught it was.
I later found out u that the CSS u posted had double dots like so:-
..tdCenter {
text-align:center;
}
so i changed it to(WITH one DOT before "tdCenter" :-
.tdCenter {
text-align:center;
}

So adding CSS to "<asp:TemplateColumn ItemStyle-Width="10%"
ItemStyle-CssClass="tdCenter">" was good and u were doing the right
thing but u added to much DOTS:):)

Hope this helps..and let me know if it worked!
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #12
"Patrick.O.Ige" <Pa*********@discussions.microsoft.com> wrote in message
news:F3**********************************@microsof t.com...
Hi Tom,
Did you get the working solution i sent to you?
Let me know!
Patrick

I did answer you on that one - maybe you didn't get it.

You're right. My mistake. But the .css file had it correct, I just added
an extra dot for some reason in the post.

It still doesn't work. But only for the Footer, as I mentioned. It does
work for the ItemTemplate.

Thanks,

Tom

"naija naija" wrote:
Tom,
U were missing something i guess i tried ur code and i added CCS to
LinkButton:-
<asp:LinkButton CommandName="Insert" CssClass="tdCenter" text="<img
src='..\images\Add.gif'border='0'>"ID="btnAdd" Runat="server" />
But i guess it wasn't the problem which i taught it was.
I later found out u that the CSS u posted had double dots like so:-
..tdCenter {
text-align:center;
}
so i changed it to(WITH one DOT before "tdCenter" :-
.tdCenter {
text-align:center;
}

So adding CSS to "<asp:TemplateColumn ItemStyle-Width="10%"
ItemStyle-CssClass="tdCenter">" was good and u were doing the right
thing but u added to much DOTS:):)

Hope this helps..and let me know if it worked!
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #13
No i sent you the working Solution!
I did it and it worked for the FOOTER!!!!!!!!
Let me know..
Patrick

"tshad" wrote:
"Patrick.O.Ige" <Pa*********@discussions.microsoft.com> wrote in message
news:F3**********************************@microsof t.com...
Hi Tom,
Did you get the working solution i sent to you?
Let me know!
Patrick


I did answer you on that one - maybe you didn't get it.

You're right. My mistake. But the .css file had it correct, I just added
an extra dot for some reason in the post.

It still doesn't work. But only for the Footer, as I mentioned. It does
work for the ItemTemplate.

Thanks,

Tom


"naija naija" wrote:
Tom,
U were missing something i guess i tried ur code and i added CCS to
LinkButton:-
<asp:LinkButton CommandName="Insert" CssClass="tdCenter" text="<img
src='..\images\Add.gif'border='0'>"ID="btnAdd" Runat="server" />
But i guess it wasn't the problem which i taught it was.
I later found out u that the CSS u posted had double dots like so:-
..tdCenter {
text-align:center;
}
so i changed it to(WITH one DOT before "tdCenter" :-
.tdCenter {
text-align:center;
}

So adding CSS to "<asp:TemplateColumn ItemStyle-Width="10%"
ItemStyle-CssClass="tdCenter">" was good and u were doing the right
thing but u added to much DOTS:):)

Hope this helps..and let me know if it worked!
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 18 '05 #14
Hi Tom..
What i did was wrap the LinkButton with DIV Element like so...

<asp:TemplateColumn ItemStyle-Width="10%"
ItemStyle-HorizontalAlign="Center">
<FooterTemplate>
<div align="center">
<asp:LinkButton CommandName="Insert" Text="<img
src='..\images\Add.gif'border='0'>" ID="btnAdd" Runat="server" />
</div>
</FooterTemplate>
<ItemTemplate>
<asp:LinkButton CommandName="Delete" Text="<img
src='..\images\Delete.gif'border='0'>" ID="btnDel" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>

It should WORK...Let me know!
Patrick


"tshad" wrote:
"Patrick.O.Ige" <Pa*********@discussions.microsoft.com> wrote in message
news:F3**********************************@microsof t.com...
Hi Tom,
Did you get the working solution i sent to you?
Let me know!
Patrick


I did answer you on that one - maybe you didn't get it.

You're right. My mistake. But the .css file had it correct, I just added
an extra dot for some reason in the post.

It still doesn't work. But only for the Footer, as I mentioned. It does
work for the ItemTemplate.

Thanks,

Tom


"naija naija" wrote:
Tom,
U were missing something i guess i tried ur code and i added CCS to
LinkButton:-
<asp:LinkButton CommandName="Insert" CssClass="tdCenter" text="<img
src='..\images\Add.gif'border='0'>"ID="btnAdd" Runat="server" />
But i guess it wasn't the problem which i taught it was.
I later found out u that the CSS u posted had double dots like so:-
..tdCenter {
text-align:center;
}
so i changed it to(WITH one DOT before "tdCenter" :-
.tdCenter {
text-align:center;
}

So adding CSS to "<asp:TemplateColumn ItemStyle-Width="10%"
ItemStyle-CssClass="tdCenter">" was good and u were doing the right
thing but u added to much DOTS:):)

Hope this helps..and let me know if it worked!
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 18 '05 #15
"Patrick.O.Ige" <Pa*********@discussions.microsoft.com> wrote in message
news:8E**********************************@microsof t.com...
Hi Tom..
What i did was wrap the LinkButton with DIV Element like so...

<asp:TemplateColumn ItemStyle-Width="10%"
ItemStyle-HorizontalAlign="Center">
<FooterTemplate>
<div align="center">
<asp:LinkButton CommandName="Insert" Text="<img
src='..\images\Add.gif'border='0'>" ID="btnAdd" Runat="server" />
</div>
</FooterTemplate>
<ItemTemplate>
<asp:LinkButton CommandName="Delete" Text="<img
src='..\images\Delete.gif'border='0'>" ID="btnDel" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>

It should WORK...Let me know!
I did that, as you suggested, and it did work.

My question is why wouldn't the other one work.

Here is my code now:

************************************************** ***
<asp:TemplateColumn ItemStyle-Width="20%"
ItemStyle-CssClass="tdCenter" >
<FooterTemplate>
<div align="center">
<asp:LinkButton CommandName="Insert" Text="<img
src='..\images\Add.gif'border='0'>" ID="btnAdd" Runat="server" />
</div>
</FooterTemplate>
<ItemTemplate>
<asp:LinkButton CommandName="Delete" Text="<img
src='..\images\Delete.gif'border='0'>" ID="btnDel" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
************************************************** ***************************

As you can see, I don't need the <div> tags to center the ItemTemplate, so
why do I need it for the FooterTemplate.

It's these little inconsistancies that drive me nuts.

Thanks for the help.

Tom. Patrick


"tshad" wrote:
"Patrick.O.Ige" <Pa*********@discussions.microsoft.com> wrote in message
news:F3**********************************@microsof t.com...
> Hi Tom,
> Did you get the working solution i sent to you?
> Let me know!
> Patrick
>


I did answer you on that one - maybe you didn't get it.

You're right. My mistake. But the .css file had it correct, I just
added
an extra dot for some reason in the post.

It still doesn't work. But only for the Footer, as I mentioned. It does
work for the ItemTemplate.

Thanks,

Tom
>
>
> "naija naija" wrote:
>
>> Tom,
>> U were missing something i guess i tried ur code and i added CCS to
>> LinkButton:-
>> <asp:LinkButton CommandName="Insert" CssClass="tdCenter" text="<img
>> src='..\images\Add.gif'border='0'>"ID="btnAdd" Runat="server" />
>> But i guess it wasn't the problem which i taught it was.
>> I later found out u that the CSS u posted had double dots like so:-
>> ..tdCenter {
>> text-align:center;
>> }
>> so i changed it to(WITH one DOT before "tdCenter" :-
>> .tdCenter {
>> text-align:center;
>> }
>>
>> So adding CSS to "<asp:TemplateColumn ItemStyle-Width="10%"
>> ItemStyle-CssClass="tdCenter">" was good and u were doing the right
>> thing but u added to much DOTS:):)
>>
>> Hope this helps..and let me know if it worked!
>> Patrick
>>
>>
>>
>> *** Sent via Developersdex http://www.developersdex.com ***
>> Don't just participate in USENET...get rewarded for it!
>>


Nov 18 '05 #16
Yeah Tom..
I understand u but what can we do..
Developers look for solutions and you have to provide it..
Anyway good it worked!!
By the way are you on MSN?IF you are send me your ID..
Enjoy
Patrick

"tshad" wrote:
"Patrick.O.Ige" <Pa*********@discussions.microsoft.com> wrote in message
news:8E**********************************@microsof t.com...
Hi Tom..
What i did was wrap the LinkButton with DIV Element like so...

<asp:TemplateColumn ItemStyle-Width="10%"
ItemStyle-HorizontalAlign="Center">
<FooterTemplate>
<div align="center">
<asp:LinkButton CommandName="Insert" Text="<img
src='..\images\Add.gif'border='0'>" ID="btnAdd" Runat="server" />
</div>
</FooterTemplate>
<ItemTemplate>
<asp:LinkButton CommandName="Delete" Text="<img
src='..\images\Delete.gif'border='0'>" ID="btnDel" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>

It should WORK...Let me know!


I did that, as you suggested, and it did work.

My question is why wouldn't the other one work.

Here is my code now:

************************************************** ***
<asp:TemplateColumn ItemStyle-Width="20%"
ItemStyle-CssClass="tdCenter" >
<FooterTemplate>
<div align="center">
<asp:LinkButton CommandName="Insert" Text="<img
src='..\images\Add.gif'border='0'>" ID="btnAdd" Runat="server" />
</div>
</FooterTemplate>
<ItemTemplate>
<asp:LinkButton CommandName="Delete" Text="<img
src='..\images\Delete.gif'border='0'>" ID="btnDel" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
************************************************** ***************************

As you can see, I don't need the <div> tags to center the ItemTemplate, so
why do I need it for the FooterTemplate.

It's these little inconsistancies that drive me nuts.

Thanks for the help.

Tom.
Patrick


"tshad" wrote:
"Patrick.O.Ige" <Pa*********@discussions.microsoft.com> wrote in message
news:F3**********************************@microsof t.com...
> Hi Tom,
> Did you get the working solution i sent to you?
> Let me know!
> Patrick
>

I did answer you on that one - maybe you didn't get it.

You're right. My mistake. But the .css file had it correct, I just
added
an extra dot for some reason in the post.

It still doesn't work. But only for the Footer, as I mentioned. It does
work for the ItemTemplate.

Thanks,

Tom
>
>
> "naija naija" wrote:
>
>> Tom,
>> U were missing something i guess i tried ur code and i added CCS to
>> LinkButton:-
>> <asp:LinkButton CommandName="Insert" CssClass="tdCenter" text="<img
>> src='..\images\Add.gif'border='0'>"ID="btnAdd" Runat="server" />
>> But i guess it wasn't the problem which i taught it was.
>> I later found out u that the CSS u posted had double dots like so:-
>> ..tdCenter {
>> text-align:center;
>> }
>> so i changed it to(WITH one DOT before "tdCenter" :-
>> .tdCenter {
>> text-align:center;
>> }
>>
>> So adding CSS to "<asp:TemplateColumn ItemStyle-Width="10%"
>> ItemStyle-CssClass="tdCenter">" was good and u were doing the right
>> thing but u added to much DOTS:):)
>>
>> Hope this helps..and let me know if it worked!
>> Patrick
>>
>>
>>
>> *** Sent via Developersdex http://www.developersdex.com ***
>> Don't just participate in USENET...get rewarded for it!
>>


Nov 19 '05 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: anonymous | last post by:
I have created a DataGrid control with checkboxes, TextBoxes, ComboBoxes, and NumericUpDowns. Since I used the DataGridBoolColumn, the checkbox is displayed in the center of the cell, horizontally...
4
by: Chris | last post by:
I think I must be going crazy. All I want to do is add a button to the bottom of a datagrid which will later run some code for a web based project. I've created a custom control that inherits from...
3
by: JL | last post by:
Hi all, I created a datagrid for information display, the layout as following, Button column:sales_no Datatextfield: sales_no CommandName: sales_no How can i get the clicked cell of...
1
by: Mark | last post by:
Hello, I have a need to add a button column to a datagtrid, below is my code and although it does not produce an error, it also does not work, any help? I'm hoping that I can capture the button...
3
by: vcornjamb | last post by:
Hello, I am developing a web form that contains some buttons and a data grid which has as its last column link buttons that will delete the data associated with that row. Everything works fine,...
2
by: Bob Hollness | last post by:
Hi group. I am a newbie to ASP.NET as you will see from some of the questions I may ask! I have a datagrid which I have populated from a database. It works great! I have added a column, via...
1
by: MattB | last post by:
I have a button column in a datagrid that is the delete button. Right now it is just a text link. When I go into the Property Builder My button choices are only LinkButton or PushButton. I'd like...
2
by: pradeep_TP | last post by:
Hello world, I have a simple datagrid on asp.net web form , in which I am showing a single button column called EDIT. The code in the .aspx files for the same is as below. ...
0
by: herman404 | last post by:
Hi everyone, I'm trying to dynamically add 3 button columns to a DataGrid object that I have on an ASP.net webpage, but I don't see any documentation on how to do it. I've seen plenty of examples...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.