on datalist command feild i had written code like this
protected void DataListShowImgTxt_ItemCommand(object source, DataListCommandEventArgs e)
{
string id = DataListShowImgTxt.DataKeys[e.Item.ItemIndex].ToString();
//DataListItem tem = DataListShowImgTxt.Items[e.Item.ItemIndex] as DataListItem;
//TextBox txtcmnet = tem.FindControl("txtcomment") as TextBox;
createDt.commonAll("Select UserName from imagedb where imgid='" + id + "'", "searchimage");
string u_name = createDt.GroupDS.Tables["searchimage"].Rows[0]["UserName"].ToString();
if (e.CommandName == "SaveImage")
{
clickpic =Convert.ToInt32(DataListShowImgTxt.DataKeys[e.Item.ItemIndex].ToString());
DataListItem teme = DataListShowImgTxt.Items[e.Item.ItemIndex] as DataListItem;
ImageButton imgbtn = teme.FindControl("Image3") as ImageButton;
imglightbox.ImageUrl = imgbtn.ImageUrl;
ScriptManager.RegisterStartupScript(Page, typeof(Page), "ShowValidation", "javascript:ShowImages();", true);
hovercoment(clickpic);
showhoverlikComment(clickpic);
}
if (e.CommandName == "like")
{
////string id = DataListShowImgTxt.DataKeys[e.Item.ItemIndex].ToString();
createDt.commonAll("insert into likeimgdb(ImgId,UserName,LikeUser,Status,LikeImgDate) values('" + id + "','" + LoginUser + "','" + u_name + "','Like','"+DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")+"')", "insertimage");
//LinkButton st = tem.FindControl("LinkButton8") as LinkButton;
if (flag == 0)
{
ShowAllFriendsImage1(LoginUser);
}
else if (flag == 1) {
ShowAllFriendsImage(selectUser);
}
}
I want to refresh my webpage only when comandname is like not when command name is saveimage
so please guide me how to refresh it
Actually my design is like this
<asp:LinkButton ID="LinkButton1" runat="server" PostBackUrl='<% #Eval("Photo")%>' >
<asp:Image ID="Image2" runat="server" ImageUrl='<% #Eval("Photo")%>' Height="60px"
Width="65px" />
</asp:LinkButton>
</td>
<td style="width: 85%">
<asp:LinkButton ID="LinkButton3" runat="server" CommandName="PrfileFName" CssClass="ppppp">
<asp:Label ID="Label1" runat="server" Text='<% #Eval("FullName")%>'></asp:Label>
</asp:LinkButton>
</td>
</tr>
<tr>
<td style="width: 15%">
</td>
<td style="width: 85%">
<asp:LinkButton ID="LinkButton8" runat="server" CommandName="SaveImage" CssClass="ppppp">
save
<asp:ImageButton ID="Image3" runat="server" ImageUrl='<% #Eval("Image")%>' Height="250px"
Width="320px" />
</asp:LinkButton>
</td>
</tr>
<tr>
<td style="width: 15%">
</td>
<td style="width: 85%">
<asp:LinkButton ID="LinkButton9" runat="server" CommandName="like" ToolTip="Like This"
CssClass="qqq">Like</asp:LinkButton> <asp:Label ID="Label5" runat="server"></asp:Label> <asp:LinkButton
ID="LBComnt" runat="server" ToolTip="Leave a Comment" CommandName="Comment" CssClass="qqq">Comment</asp:LinkButton> <asp:Label
ID="Label4" runat="server" Text='<% #Eval("AddDate")%>'></asp:Label>
</td>
</tr>
<%-- comee--%>
<tr>
<td style="width: 15%">
</td>
<td style="width: 85%">
<asp:DataList ID="DataListLikeComnt" runat="server" CssClass="datalistborder" Width="308px">
<ItemTemplate>
<table width="100%">
<tr>
<td style="width: 15%" align="right">
<asp:ImageButton ID="likeimagebutton" runat="server" ImageUrl="~/ProfileImage/like.jpeg"
Width="30%" Height="30%" />
</td>
<td style="width: 85%">
<asp:LinkButton ID="LblLike" runat="server" Text='<% #Eval("CountLike")%>' CssClass="qqq"></asp:LinkButton>
<asp:Label ID="Label6" runat="server" Text="People Likes" CssClass="www"></asp:Label>
</td>
</tr>
<tr>
<td style="width: 15%" align="right">
<asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/images/internet_group_chat.png"
Width="30%" Height="30%" />
</td>
<td style="width: 85%">
<asp:LinkButton ID="Lblcoment" runat="server" Text='<% #Eval("CountComment")%>' CssClass="qqq"></asp:LinkButton>
<asp:Label ID="Label7" runat="server" Text="People Comments" CssClass="www"></asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</td>
</tr>
<tr>
<td style="width: 15%">
</td>
<td style="width: 85%">
<asp:DataList ID="DataListShowComment" runat="server" CssClass="datalistborder" Width="300px">
<ItemTemplate>
<table width="100%" style="background-color: #e9edf1;">
<tr>
<td style="width: 15%">
<asp:LinkButton ID="LinkButton8" runat="server" CssClass="ppppp" CommandName="CommentProfImage">
<asp:Image ID="Image3" runat="server" ImageUrl='<% #Eval("Photo")%>' Height="30px"
Width="30px" />
</asp:LinkButton>
</td>
<td style="width: 85%">
<table width="100%">
<tr>
<td>
<asp:LinkButton ID="LBProfileImage" runat="server" CssClass="ppppp">
<asp:Label ID="Label1" runat="server" CssClass="www" Text='<% #Eval("FullName")%>'></asp:Label>
</asp:LinkButton> <asp:Label ID="Label8" runat="server" CssClass="www" Text='<% #Eval("Comment")%>'></asp:Label>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
And i want to open image on commandname =SaveImage and update like counter on command name = like
This both is working fine but when i am clicking on like its moving to start location of the page
I want it to just update the count not to move on start
Use it ,
Response.Redirect(Request.RawUrl);
Put this code in your condition ,
if (e.CommandName == "like")
{
////string id = DataListShowImgTxt.DataKeys[e.Item.ItemIndex].ToString();
createDt.commonAll("insert into likeimgdb(ImgId,UserName,LikeUser,Status,LikeImgDate) values('" + id + "','" + LoginUser + "','" + u_name + "','Like','"+DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")+"')", "insertimage");
//LinkButton st = tem.FindControl("LinkButton8") as LinkButton;
if (flag == 0)
{
ShowAllFriendsImage1(LoginUser);
}
else if (flag == 1) {
ShowAllFriendsImage(selectUser);
}
Response.Redirect(Request.RawUrl);
}
Related
I need to make a old asp project compatible with Chrome.
This is the html:
<table class="tabellaricercasmall" width="100%" height="5%" border="0">
<tr>
<%--<td class="welcome" width="45%">Società </td>
<td>
<asp:DropDownList ID="Societa" runat="server" AutoPostBack="false" Width="100%"></asp:DropDownList>
</td>--%>
<td class="welcome" width="15%">Matricola</td>
<td Width="15%">
<asp:TextBox ID="Matricola" runat="server" MaxLength="10" Columns="12" Width="100%" ></asp:TextBox>
</td>
<td class="welcome" Witdh="50%">Nominativo</td>
<td Width="20%">
<asp:TextBox ID="nominativo" runat="server" MaxLength="50" Columns="20" Width="100%" ></asp:TextBox>
</td>
<td class="welcome" width="20%">Codice Fiscale</td>
<td Width="20%">
<asp:TextBox ID="CodFiscale" runat="server" Columns="32" MaxLength="16" Width="100%" ></asp:TextBox>
</td>
</tr>
<tr>
<td class="welcome" width="15%">Periodo Da.</td>
<td>
<asp:DropDownList ID="DataDaDropDownList" runat="server" width="100%"/>
</td >
<td class="welcome" >Periodo A.</td>
<td>
<asp:DropDownList ID="DataADropDownList" runat="server" width="100%"/>
</td>
</tr>
<tr>
<td colspan="6">
<asp:Button ID="Button2" runat="server" Text="Cerca" CssClass="inputbutton" OnClick="Button1_Click1" />
</td>
</tr>
</table>
Here the results:
The top result (with the correct result) is internet explorer 11.
as you can see on chrome the text width is incorrect.
There is a way to fix ?
Thanks !
I have added a new row .
for defaultGPnamer i need to bring that to the right end.
Please help on this .
attached the code
<LayoutTemplate>
<asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
</LayoutTemplate>
<ItemTemplate>
<div class="rounded" style="margin-left:10px">
<table style="width: 560px; height:95px;">
<tr>
<td colspan="3" style="height:22px">
<div>
<span style="font-size:11pt; color:#008FBE; font-weight:bold; line-height: 22px"><%#Eval("MMHMember")%><%#Eval("UserName") %></span>
<i><b><%#Eval("gender")%> <%#Eval("Age","{0} Yrs</b>") %></b></i>
<span><%#Eval("DateOfBirth")%>
</span>
</div>
</td>
<td style="text-align:right">
<span style="color:#008FBE; font-size:11pt; line-height: 22px;"><%#Eval("NHINumber")%></span>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lbldefaultgp" runat="server" style="font-weight:bold;color:#008FBE;"><%#Eval("DefaultGPName")%></asp:Label>
</td>
</tr>
<tr style="text-align:left; vertical-align:top">
<td style="width:100px;">
<asp:Image ID="imgPatientPhoto" runat="server" ImageUrl='<%#GetPhotoURL(Eval("PhotoURL","{0}"))%>' style="width:90px;height:95px" />
</td>
<td style="width: 125px">
<br />
<asp:Label ID="lblHome" runat="server" style="font-weight:bold"><%#Eval("HomePhone")%></asp:Label>
<br />
<asp:Label ID="lblWork" runat="server" style="font-weight:bold"><%#Eval("WorkPhone")%></asp:Label>
<br />
<asp:Label ID="lblMobail" runat="server" style="font-weight:bold"><%#Eval("Mobilenumber")%></asp:Label>
</td>
<td style="width:140px;">
<asp:Label ID="lblAddress" runat="server" style="font-weight:bold"><%#Eval("Address") %></asp:Label>
</td>
<td style="" >
<asp:Label runat ="server" ID ="lblEnrolledPractice"><%#Eval("businessname") %> </asp:Label> <br />
<asp:Label runat ="server" ID ="lblCasualPractice"><%#Eval("CasualBusinessname") %> </asp:Label>
<p>
<asp:LinkButton ID="lnkViewConsentSetting" runat="server" CommandArgument="<%# Container.DataItemIndex %>" CommandName="ConsentSetting" Visible="<%# ApplyCareSetting %>" >View Consent Settings</asp:LinkButton>
</p>
<p>
<asp:LinkButton ID="lnkViewHealthSummary" runat="server" CommandArgument="<%# Container.DataItemIndex %>" CommandName="HealthSummary" Visible ='<%# SetHESVisible("SEHR") %>'>View Health Summary</asp:LinkButton>
<asp:LinkButton ID="lnkViewHealthSummaryConsent" runat="server" Visible ='<%# SetHESVisible("CONSENT") %>' Text="View Health Summary"></asp:LinkButton>
</p>
</td>
</tr>
</table>
</div>
</ItemTemplate>
I would be greatful if someone can help on this.
Label id is lbldefaultgp.
need to bring that data to right end in the banner.
notes::::
<LayoutTemplate>
<asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
</LayoutTemplate>
<ItemTemplate>
<div class="rounded" style="margin-left:10px">
<table style="width: 560px; height:95px;">
<tr>
<td colspan="3" style="height:22px">
<div>
<span style="font-size:11pt; color:#008FBE; font-weight:bold; line-height: 22px"><%#Eval("MMHMember")%><%#Eval("UserName") %></span>
<i><b><%#Eval("gender")%> <%#Eval("Age","{0} Yrs</b>") %></b></i>
<span><%#Eval("DateOfBirth")%>
</span>
</div>
</td>
<td style="text-align:right">
<span style="color:#008FBE; font-size:11pt; line-height: 22px;"><%#Eval("NHINumber")%></span>
</td>
</tr>
<tr>
<td colspan="3" style="height:22px">
<div>
</div>
</td>
<td>
<p>is this the thing you want?</p> <asp:Label ID="lbldefaultgp" runat="server" style="font-weight:bold;color:#008FBE;"><%#Eval("DefaultGPName")%></asp:Label>
</td>
</tr>
<tr style="text-align:left; vertical-align:top">
<td style="width:100px;">
<asp:Image ID="imgPatientPhoto" runat="server" ImageUrl='<%#GetPhotoURL(Eval("PhotoURL","{0}"))%>' style="width:90px;height:95px" />
</td>
<td style="width: 125px">
<br />
<asp:Label ID="lblHome" runat="server" style="font-weight:bold"><%#Eval("HomePhone")%></asp:Label>
<br />
<asp:Label ID="lblWork" runat="server" style="font-weight:bold"><%#Eval("WorkPhone")%></asp:Label>
<br />
<asp:Label ID="lblMobail" runat="server" style="font-weight:bold"><%#Eval("Mobilenumber")%></asp:Label>
</td>
<td style="width:140px;">
<asp:Label ID="lblAddress" runat="server" style="font-weight:bold"><%#Eval("Address") %></asp:Label>
</td>
<td style="" >
<asp:Label runat ="server" ID ="lblEnrolledPractice"><%#Eval("businessname") %> </asp:Label> <br />
<asp:Label runat ="server" ID ="lblCasualPractice"><%#Eval("CasualBusinessname") %> </asp:Label>
<p>
<asp:LinkButton ID="lnkViewConsentSetting" runat="server" CommandArgument="<%# Container.DataItemIndex %>" CommandName="ConsentSetting" Visible="<%# ApplyCareSetting %>" >View Consent Settings</asp:LinkButton>
</p>
<p>
<asp:LinkButton ID="lnkViewHealthSummary" runat="server" CommandArgument="<%# Container.DataItemIndex %>" CommandName="HealthSummary" Visible ='<%# SetHESVisible("SEHR") %>'>View Health Summary</asp:LinkButton>
<asp:LinkButton ID="lnkViewHealthSummaryConsent" runat="server" Visible ='<%# SetHESVisible("CONSENT") %>' Text="View Health Summary"></asp:LinkButton>
</p>
</td>
</tr>
</table>
</div>
</ItemTemplate>
--source code--
<table style="border: thin ridge #000000; width: 72%; margin-top: 21px; margin-left: 243px;"
bgcolor="#CCCCFF">
<tr align="center">
<td class="style11">
</td>
<td class="style2">
</td>
<td class="style4">
</td>
<td class="style17">
</td>
</tr>
<tr>
<td class="style14">
</td>
<td class="style15" align="center">
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" Text="0.125"
oncheckedchanged="CheckBox1_CheckedChanged1" CausesValidation="True" />
</td>
<td class="style16" align="center">
<asp:CheckBox ID="CheckBox2" runat="server" AutoPostBack="True" Text="0.25"
oncheckedchanged="CheckBox2_CheckedChanged" CausesValidation="True" />
</td>
<td class="style18">
</td>
</tr>
<tr align="center" style="background-color:Fuchsia;">
<td class="style11">
L</td>
<td class="style2">
B
</td>
<td class="style4">
W</td>
<td class="style17">
N</td>
</tr>
<tr align="center" style="background-color:Fuchsia;">
<td class="style12">
<asp:UpdatePanel ID="UpdatePanel4" runat="server">
<ContentTemplate>
<asp:TextBox ID="TextBox1" runat="server" Width="115px" TabIndex="1" ></asp:TextBox>
</ContentTemplate>
</asp:UpdatePanel>
</td>
<td class="style7">
<asp:UpdatePanel ID="UpdatePanel5" runat="server">
<ContentTemplate>
<asp:TextBox ID="TextBox2" runat="server" Width="115px" TabIndex="2"></asp:TextBox>
</ContentTemplate>
</asp:UpdatePanel>
</td>
<td class="style9">
<asp:UpdatePanel ID="UpdatePanel3" runat="server">
<ContentTemplate>
<asp:TextBox ID="TextBox3" runat="server" Width="115px" AutoPostBack="True"
ontextchanged="TextBox3_TextChanged" TabIndex="3"></asp:TextBox>
</ContentTemplate>
</asp:UpdatePanel>
</td>
<td class="style19">
<asp:UpdatePanel ID="UpdatePanel6" runat="server">
<ContentTemplate>
<asp:TextBox ID="TextBox4" runat="server" Width="115px" TabIndex="4"></asp:TextBox>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
<tr><td class="style13"></td><td class="style8">
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="TextBox2"></asp:RequiredFieldValidator>
</td>
<td class="style10">
</td><td class="style20"></td></tr>
<tr align="right" style="background-color:snow;">
<td class="style3" colspan="2">
<asp:TextBox ID="TextBox7" runat="server" Width="142px"></asp:TextBox>
</td>
<td align="left" class="style4">
Price</td>
<td class="style17">
</td>
</tr>
<tr align="center">
<td class="style3" colspan="2">
</td>
<td align="left" class="style4">
</td>
<td class="style17">
</td>
</tr>
<tr align="center">
<td class="style3" colspan="2" align="right">
<asp:Button ID="Button3" runat="server" onclick="Button3_Click"
Text="Calculate" CausesValidation="False" />
</td>
<td align="left" colspan="2">
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="Calculate" />
<input type="hidden" runat="server" id="hid" /></td>
</tr>
</table>
--code behind--
protected void Button1_Click(object sender, EventArgs e)
{
l = Convert.ToDecimal(TextBox1.Text);
b = Convert.ToDecimal(TextBox2.Text);
w = Convert.ToDecimal(TextBox3.Text);
n = Convert.ToDecimal(TextBox4.Text);
price = Convert.ToDecimal(TextBox7.Text);
avg = (l * b * w * n) / 4;
tot = avg * price;
try
{
string ins = "insert into cal_tbl(l,b,w,n,price,average,total)values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox7.Text + "','" + avg.ToString("#,0.00") + "','" + tot.ToString("#,0.00") + "')";
SqlCommand cmd = new SqlCommand(ins, con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
Bindgrid();
}
catch (Exception ex)
{
}
clearcontrols();
}
Now the problem is when i enter a value greater than 15 in textbox7(price) my calculation is not working and the value is not saving in database...help me solve that.
I have defined all columns as decimal datatype in sql.Is there any problem in that?
You should remove all ' in query. Because all columns are decimal. And should use .ToString("0.00")
string ins = "insert into cal_tbl(l,b,w,n,price,average,total)values(" + TextBox1.Text + "," + TextBox2.Text + "," + TextBox3.Text + "," + TextBox4.Text + "," + TextBox7.Text + "," + avg.ToString("0.00") + "," + tot.ToString("0.00") + ")";
I have a table in which there are many tr and td's
Currently it looks like this in the below image.
The area in the arrow needs to be reduced a bit. I tried adding padding but it didn't worked.
Below is the html
<table width="100%" border="0" cellspacing="0" cellpadding="5" style="background-color: #EAEFF5">
<tr>
<td class="label">
Project :
</td>
<td class="field" style="width: 10%;">
<asp:DropDownList ID="ddlProject" runat="server" Width="80%" AutoPostBack="false">
<asp:ListItem Value="0">--Select--</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="label">
Taluka :
</td>
<td class="field">
<%--<asp:TextBox ID="txtTaluka" runat="server" Width="80%"></asp:TextBox>--%>
<asp:DropDownList ID="ddlTaluka" runat="server" Width="80%">
<%--<asp:ListItem Value="0">--Select--</asp:ListItem>--%>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="label">
Transaction Type:
</td>
<td class="field" style="width: 30%;">
<asp:DropDownList ID="ddlTranType" runat="server" Width="50%" AutoPostBack="true"
OnSelectedIndexChanged="ddlTranType_SelectedIndexChanged">
<asp:ListItem Value="0">--Select--</asp:ListItem>
<asp:ListItem Value="AGR">Agreement Type</asp:ListItem>
<asp:ListItem Value="EXP">Expense Type</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="label">
7/12 :
</td>
<td class="field" style="width: 30%;">
<%--<obout:ComboBox ID="ComboBox1" runat="server" Width="180px" Height="150px" AutoClose="false"
AllowCustomText="true" AutoValidate="true" AllowEdit="false" SelectionMode="Multiple"
DataTextField="COLUMN7_12" DataValueField="COLUMN7_12" OpenOnFocus="true" EmptyText="Select 7/12 ..."
EnableVirtualScrolling="true" EnableLoadOnDemand="true" OnLoadingItems="ComboBox1_LoadingItems"
Visible="true">
<ClientSideEvents OnItemClick="ComboBox1_Click" />
<ItemTemplate>
<input type="checkbox" runat="server" id="chk712" />
<%# Container.Text %>
</ItemTemplate>
<FooterTemplate>
Displaying items
<%# Container.ItemsCount > 0 ? "1" : "0" %>-<%# Container.ItemsLoadedCount %>out
of
<%# Container.ItemsCount %>.
</FooterTemplate>
</obout:ComboBox>--%>
<asp:TextBox ID="txt712" runat="server" Width="60%"></asp:TextBox>
<br />
<i>Start typing...</i>
</td>
</tr>
<tr>
<td class="label">
Ref No :
</td>
<td class="field" style="width: 30%;">
<input type="text" id="txtrefno" runat="server" style="width: 60%" />
<img src="~/Images/search.gif" alt="Help" onclick="Search_Click()" style="cursor: pointer"
id="ImgSearch" runat="server" /><br />
<span style="color: #1B1E24;">(Auto Generated field)</span>
</td>
<td class="label">
Status :
</td>
<td class="field" style="width: 30%;">
<asp:DropDownList ID="ddlStatus" runat="server" Width="50%" AutoPostBack="false">
<asp:ListItem Value="0">--Select--</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="label">
Ref Date :
</td>
<td class="field" style="width: 30%;">
<input type="text" id="txtRefdate" runat="server" style="width: 60%" disabled="disabled" />
<%--<cc3:Calendar ID="CalDt1" runat="server" DatePickerMode="true" DatePickerImagePath="../Images/icon2.gif"
TextBoxId="txtRefdate" Enabled="true" CultureName="en-GB" DateFormat="dd/MM/yyyy">
</cc3:Calendar>--%>
</td>
<td class="label">
Transaction Date :
</td>
<td class="field" style="width: 30%;">
<input type="text" id="txtdate" runat="server" style="width: 50%" readonly="readonly" />
<cc3:Calendar ID="Calc2" runat="server" DatePickerMode="true" DatePickerImagePath="../Images/icon2.gif"
TextBoxId="txtdate" Enabled="true" CultureName="en-GB" DateFormat="dd/MM/yyyy">
</cc3:Calendar>
</td>
</tr>
<tr>
<td class="label">
Remarks :
</td>
<td>
<asp:TextBox ID="txtRemarks" runat="server" Width="80%" TextMode="MultiLine"></asp:TextBox>
</td>
</tr>
</table>
CSS
.label
{
width: 20%;
height: 10%;
}
.field
{
width: 30%;
height: 10%;
}
Fiddle of the html
I'd say you should remove the cellpadding property from the table and do that via css as well.
increased or decreased the padding to adjust the space between two td's
.field, .label {
padding: 2px;
}
I modified your jsfiddle https://jsfiddle.net/g0oyxfqs/2/
table tr:first-child td {
padding-bottom: 1px; // insert total padding length here
}
table tr:nth-child(2) td {
padding-top: 0;
}
i am trying to figure out how to fix the header row with in the repeater using asp.net. When trying to put position:fixed; in the tr tag. It seems to fix it but it becomes smaller in size and doesn't work with the rest of the table.
any hints or help in the right direction would help significantly!
thanks
<div class="form-panel" style="font-size: small; text-align: left;">
<div class="header">
<div class="contentRestriction" style="height: 22px">
Action Bulletin Exception
<asp:button id="addException" text="Add Exception" runat="server" style="float: right; margin-right: 20px" onclick="addExceptions" />
</div>
</div>
<div class="commands">
<div class="contentRestriction" style="overflow-y: scroll; width: 100%; height: 185px">
<asp:repeater id="repException" runat="server" datasourceid="SP_AB_BULLETIN_EXCEPTION">
<HeaderTemplate>
<div class="form-panel" style="font-size: small;">
<table class="notepad-table" cellpadding="2" cellspacing="0" width="100%" >
<tr style="background-color: #eeeeee; font-weight: bold; ">
<td>Date Time From</td>
<td>Date Time To</td>
<td>Status</td>
<td>Last Modified</td>
<td>Last Modified By</td>
<td>Action</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr id="tr1" runat="server">
<td>
<asp:Literal ID="Literal1" runat="server" Text='<%# Eval("EFTV_FROM") %>' />
</td>
<td>
<asp:Literal ID="Literal2" runat="server" Text='<%# Eval("EFTV_TO") %>' />
</td>
<td>
<asp:Literal ID="Literal3" runat="server" Text='<%# Eval("AB_STATUS1") %>' />
</td>
<td>
<asp:Literal ID="Literal4" runat="server" Text='<%# Eval("LAST_MOD_DATE") %>' />
</td>
<td>
<asp:Literal ID="Literal6" runat="server" Text='<%# Eval("UserName") %>' />
</td>
<td>
<asp:Button ID="editException" Text="Edit" runat="server" CommandName="EXID" CommandArgument='<%# Eval("EX_ID") %>' OnCommand="editException" />
<asp:Button ID="deleteException" Text="Delete" runat="server" CommandName="EXID" CommandArgument='<%# Eval("EX_ID") %>' OnCommand="deleteException" />
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</div>
</FooterTemplate>
</asp:Repeater>
</div>
</div>
</div>
To get the fixed header effect you can make two small changes to your code.
1) Paste the following style rules in the <head> section of your page:
<style type="text/css">
table tbody, table thead {
display: block;
}
table tbody {
overflow: auto;
height: 100px;
}
th, td {
width: 150px;
}
</style>
2) Replace your <div class="commands"> with the one below:
<div class="commands">
<asp:Repeater ID="repException" runat="server" DataSourceID="SP_AB_BULLETIN_EXCEPTION">
<HeaderTemplate>
<div class="form-panel" style="font-size: small;">
<table class="notepad-table" cellpadding="2" cellspacing="0">
<thead>
<tr style="background-color: #eeeeee; font-weight: bold;">
<th>Date Time From</th>
<th>Date Time To</th>
<th>Status</th>
<th>Last Modified</th>
<th>Last Modified By</th>
<th>Action</th>
</tr>
</thead>
<tbody>
</HeaderTemplate>
<ItemTemplate>
<tr id="tr1" runat="server">
<td>
<asp:Literal ID="Literal1" runat="server" Text='<%# Eval("EFTV_FROM") %>' />
</td>
<td>
<asp:Literal ID="Literal2" runat="server" Text='<%# Eval("EFTV_TO") %>' />
</td>
<td>
<asp:Literal ID="Literal3" runat="server" Text='<%# Eval("AB_STATUS1") %>' />
</td>
<td>
<asp:Literal ID="Literal4" runat="server" Text='<%# Eval("LAST_MOD_DATE") %>' />
</td>
<td>
<asp:Literal ID="Literal6" runat="server" Text='<%# Eval("UserName") %>' />
</td>
<td>
<asp:Button ID="editException" Text="Edit" runat="server" CommandName="EXID" CommandArgument='<%# Eval("EX_ID") %>' OnCommand="editException" />
<asp:Button ID="deleteException" Text="Delete" runat="server" CommandName="EXID" CommandArgument='<%# Eval("EX_ID") %>' OnCommand="deleteException" />
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</tbody>
</table>
</div>
</FooterTemplate>
</asp:Repeater>
</div>
Output: