Render UserControl in Same line as other controls in a <td> - c#

I want to render Usercontrol in the same line as my other controls in . By default, it renders in new line for user control.
Here is my Markup
<tr>
<td>
<asp:ContentPlaceHolder ID="TitleContentPlaceHolder" runat="server">
<asp:Label ID="lblTitle" runat="server" EnableTheming="False" Font-Size="Small" ForeColor="Green"
Font-Bold="True" Style="margin-left: 18px"></asp:Label>
<asp:HyperLink ID="gotoHyperLink" Visible="false" EnableTheming="False" Font-Size="Small"
ForeColor="Green" Font-Bold="True" Style="margin-left: 2px" runat="server" NavigateUrl=""
Target="_blank">- To Wiki</asp:HyperLink>
<uc1:GoToRequestControl ID="GoToRequestControl1" runat="server" />
</asp:ContentPlaceHolder>
</td>
</tr>
I want to render the UC1 in the same line as previous two controls in Div if possible after some spacing to the right. Any fix on how to achieve this?
My User Control is designed using despite that I want it to be on same line. Here is my Usercontrol's HTML
<asp:UpdatePanel ID="UpdatePanel1" runat="server" >
<ContentTemplate>
<asp:Panel runat="server" DefaultButton="btnGo" BackColor="Transparent">
<table style="margin-left:18px">
<tr valign="top">
<td>
<b><asp:Literal ID="Label1" runat="server" Text="Coeus Request ID: " EnableTheming="False"></asp:Literal></b>
</td>
<td>
<asp:TextBox ID="tbRequestId" runat="server" EnableTheming="false" Width="260px"></asp:TextBox>
</td>
<td>
<asp:Button ID="btnGo" runat="server" Text="Go" OnClick="btnGo_Click" OnClientClick="CheckLock();"
CausesValidation="False" UseSubmitBehavior="false" />
</td>
<td>
<asp:Label ID="lblStatus" runat="server" Text="" EnableTheming="False" ForeColor="Red"></asp:Label>
</td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>

Related

How will use multiple fileupload in same Asp net page

In my Project I add three FileUploder.I have already used UpdatePanel in my page. also I had given Updatepanel each fileuploder. My problem is that when I click on the button Edit, FileUploader didnot take selected file.I need postfile from every fileuploader.also
I add trigger for the button btnEdit,but on Click event none of the fileuploader take selcted file.
How will manage this three file uploder in this page. I mentioned my code below.
<table class="ui-accordion">
<asp:UpdatePanel ID="updatepanel1" runat="server"><ContentTemplate>
<tr>
<td align="left" class="style2">
<asp:Label ID="Label14" runat="server" Text="Experience Certificate"></asp:Label>
</td>
<td align="left">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:FileUpload ID="FileUpload2" runat="server" /><asp:Image ID="Img1"
runat="server" Height="33px" Width="36px" />
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td align="left" class="style2">
<asp:Label ID="Label14" runat="server" Text="Experience Certificate"></asp:Label>
</td>
<td align="left">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:FileUpload ID="FileUpload3" runat="server" /><asp:Image ID="Img1"
runat="server" Height="33px" Width="36px" />
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td align="left" class="style2">
<asp:Label ID="Label14" runat="server" Text="Experience Certificate"></asp:Label>
</td>
<td align="left">
<asp:UpdatePanel ID="UpdatePanel3" runat="server">
<ContentTemplate>
<asp:FileUpload ID="FileUpload1" runat="server" /><asp:Image ID="Img1"
runat="server" Height="33px" Width="36px" />
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td class="style2">
<%--
<asp:Button ID="Button3" class="btn-primary" runat="server" Text="Next"
Height="36px" Width="74px" /> --%>
<asp:HiddenField ID="Hfedi" runat="server" Value=" " />
</td>
<td align="left">
<asp:Button ID="btnEdit" class="btn-primary" runat="server" Text="Edit"
Height="36px" Width="74px" onclick="btnEdit_Click" />
<asp:Label ID="lblmsg" runat="server" ForeColor="Red"> </asp:Label>
</td>
</tr>
</table>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnEdit"/>
</Triggers>
</asp:UpdatePanel>

Another way to update listbox values in listview

I have a ListBox within a ListView that is populated by a SqlDataSource. This ListBox is in the InsertItemTemplate of my ListView.
Is there a way to select a value in the ListBox, click the update button and bring up a TextBox with the selected value so that the user can change the information to save and update? I was thinking if there is a way to bring up a popup window or TextBox that shows the selected value so I can update it.
<asp:ListView ID="FormSectionListView" runat="server" InsertItemPosition="FirstItem">
//omitted other templates because I am not using them.
<InsertItemTemplate>
<tr style="">
<td>
<div style="font-size: .8em; display: block">
<asp:FormView ID="FormSectionFormView" runat="server" DataKeyNames="FormSectionID" DataSourceID="FormSectionDataSource" RowStyle-VerticalAlign="NotSet">
<ItemTemplate>
<tr>
<td>
<asp:Button ID="InsertButton"
runat="server"
Text="Insert"
OnClick="FormSectionButton_Click"
Font-Size="1.2em" />
<asp:Button ID="UpdateButton"
runat="server"
Text="Update"
Font-Size="1.2em"/>
</td>
<td align="center">
<div style: align="center">
<asp:Label ID="Label1"
runat="server"
Font-Bold="true"
Text="Section Instruction"
Font-Size="1.2em">
</asp:Label>
</div>
<div style="width:800px; height:auto; overflow:auto">
<asp:ListBox ID="SectionInstructionListBox"
DataSourceID="SectionInstructionSource"
runat="server"
DataTextField="Instruction"
Visible="True" />
</div>
</td>
</tr>
<tr>
<td>
</td>
<td>
<div style="padding-top: 4em; width:800px">
<asp:Label ID="Label5"
runat="server"
Font-Bold="true"
Text="Insert New Instruction"
Font-Size="1.2em">
</asp:Label>
<asp:TextBox ID="SectionInstructionTextBox"
runat="server"
Width="800px" />
</div>
</td>
</tr>
</ItemTemplate>
</asp:FormView>
</div>
</td>
</tr>
</InsertItemTemplate>
</asp:ListView>

Asp.net and ListView Control

I am printing data using List View control. I used LinkButton in itemtemplate. I want that column name should not be printed.....................................................
What changes i have to make?
<asp:ListView ID="ListView1" runat="server" DataKeyNames="userid" DataSourceID="SqlDataSource1">
<AlternatingItemTemplate>
<tr style="">
<td>
<asp:Label ID="catgLabel" runat="server" Text='<%# Eval("catg") %>' />
</td>
<td>
<asp:Label ID="useridLabel" runat="server" Text='<%# Eval("userid") %>' />
</td>
<td>
<asp:Label ID="datetimeLabel" runat="server" Text='<%# Eval("datetime") %>' />
</td>
</tr>
</AlternatingItemTemplate>
<EditItemTemplate>
<tr style="">
<td>
<asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Update" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
</td>
<td>
<asp:TextBox ID="catgTextBox" runat="server" Text='<%# Bind("catg") %>' />
</td>
<td>
<asp:Label ID="useridLabel1" runat="server" Text='<%# Eval("userid") %>' />
</td>
<td>
<asp:TextBox ID="datetimeTextBox" runat="server" Text='<%# Bind("datetime") %>' />
</td>
</tr>
</EditItemTemplate>
<EmptyDataTemplate>
<table runat="server" style="">
<tr>
<td>No data was returned.</td>
</tr>
</table>
</EmptyDataTemplate>
<InsertItemTemplate>
<tr style="">
<td>
<asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Clear" />
</td>
<td>
<asp:TextBox ID="catgTextBox" runat="server" Text='<%# Bind("catg") %>' />
</td>
<td>
<asp:TextBox ID="useridTextBox" runat="server" Text='<%# Bind("userid") %>' />
</td>
<td>
<asp:TextBox ID="datetimeTextBox" runat="server" Text='<%# Bind("datetime") %>' />
</td>
</tr>
</InsertItemTemplate>
<ItemTemplate>
<tr style="">
<td>
<asp:Label ID="catgLabel" runat="server" Text='<%# Eval("catg") %>' />
</td>
<td>
<asp:Label ID="useridLabel" runat="server" Text='<%# Eval("userid") %>' />
</td>
<td>
<asp:Label ID="datetimeLabel" runat="server" Text='<%# Eval("datetime") %>' />
</td>
</tr>
</ItemTemplate>
<LayoutTemplate>
<table runat="server">
<tr runat="server">
<td runat="server">
<table id="itemPlaceholderContainer" runat="server" border="0" style="">
<tr runat="server" style="">
<th runat="server">catg</th>
<th runat="server">userid</th>
<th runat="server">datetime</th>
</tr>
<tr id="itemPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
<tr runat="server">
<td runat="server" style=""></td>
</tr>
</table>
</LayoutTemplate>
<SelectedItemTemplate>
<tr style="">
<td>
<asp:Label ID="catgLabel" runat="server" Text='<%# Eval("catg") %>' />
</td>
<td>
<asp:Label ID="useridLabel" runat="server" Text='<%# Eval("userid") %>' />
</td>
<td>
<asp:Label ID="datetimeLabel" runat="server" Text='<%# Eval("datetime") %>' />
</td>
</tr>
</SelectedItemTemplate>
</asp:ListView>
Try setting ListView's HeaderStyle property to None. It can take 3 values:
a. None
b. Nonclickable
c. Clickable
The below exact texts from MSDN is sufficient::
The HeaderStyle property allows you to specify whether the column headers are visible or, if they are visible, whether they will function as clickable buttons. If the HeaderStyle property is set to ColumnHeaderStyle.None, the column headers are not displayed.
Let us know if you also tried the same or if different method, please post it here so as to be helpful to others.

First modalpopup in first panel does not open until second modalpopup opens in second panel

I have one updatepanel exists with two panels. Each panel have two buttons to open popup. I have two modalpopup & its target panels just below of two panels.Everything is working fine, but I am getting problem, if I click button in first panel then modalpopup does not open, but when I click button in second panel after click button in first panel then popup opens & viceversa.
I used following code:
<asp:UpdatePanel ID="up1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="pnl1" runat="server">
<asp:Button ID="btn1" runat="server" class="add-btn-1" Text="Add" />
</asp:Panel>
<asp:Panel ID="pnl2" runat="server">
<asp:Button ID="btn2" runat="server" class="add-btn-1" Text="Add" />
</asp:Panel>
<cc1:ModalPopupExtender ID="ModalPopup1" PopupControlID="pnlpopup1" TargetControlID="btn1"
BackgroundCssClass="modalBackground" runat="server" />
<asp:Panel runat="server" ID="pnlpopup1">
<%--code here--%>
</asp:Panel>
<cc1:ModalPopupExtender ID="ModalPopup2" PopupControlID="pnlpopup2" TargetControlID="btn2"
BackgroundCssClass="modalBackground" runat="server" />
<asp:Panel runat="server" ID="pnlpopup2">
<%--code here--%>
</asp:Panel>
</ContentTemplate>
What will be solution to solve this problem?
Thank you.
I executed your code and found no problems.It works.So post the code that you have given inside <%--code here--%>.I would also suggest that you add a OkControlID to your ModalPopupExtender.
<asp:UpdatePanel ID="up1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="pnl1" runat="server">
<asp:Button ID="btn1" runat="server" class="add-btn-1" Text="Add" />
</asp:Panel>
<asp:Panel ID="pnl2" runat="server">
<asp:Button ID="btn2" runat="server" class="add-btn-1" Text="Add" />
</asp:Panel>
<Ajax:ModalPopupExtender ID="ModalPopup1" PopupControlID="pnlpopup1" TargetControlID="btn1"
BackgroundCssClass="modalBackground" runat="server" />
<asp:Panel runat="server" ID="pnlpopup1" Style="width:400px;height:100px; background: gray;">
<table width="100%">
<tr>
<td align="left">
<asp:Label ID="lblheadinglunchout" Font-Underline="true" Text="First Popup"
runat="server" CssClass="labelPopup" Style="text-decoration: none"></asp:Label>
</td>
<td align="right">
<asp:ImageButton ID="imgbtnCancelPopUp" ImageUrl="Images/popupclose_button.png"
runat="server" Style="vertical-align: top;" CssClass="button" />
</td>
</tr>
</table>
</asp:Panel>
<Ajax:ModalPopupExtender ID="ModalPopup2" PopupControlID="pnlpopup2" TargetControlID="btn2"
BackgroundCssClass="modalBackground" runat="server" />
<asp:Panel runat="server" ID="pnlpopup2" Style="width:400px;height:100px; background: gray;">
<table width="100%">
<tr>
<td align="left">
<asp:Label ID="Label1" Font-Underline="true" Text="Secound Popup"
runat="server" CssClass="labelPopup" Style="text-decoration: none"></asp:Label>
</td>
<td align="right">
<asp:ImageButton ID="ImageButton1" ImageUrl="Images/popupclose_button.png"
runat="server" Style="vertical-align: top;" CssClass="button" />
</td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>

Keep page position on postback

I have a problem:
<asp:Label ID="Label1" runat="server" Text="Name" CssClass="left"></asp:Label>
<asp:LinkButton ID="LinkEdit" runat="server" CssClass="right_bottom"
onclick="LinkEdit_Click" Height="16px">edit</asp:LinkButton>
<asp:LinkButton ID="Linkhide" runat="server" CssClass="right_bottom"
onclick="Linkhide_Click" Visible="False" hide</asp:LinkButton>
<br />
<hr style="width: 740px; height: -6px; margin-left: 0px; " />
<asp:Label ID="labelFullname" runat="server" Text="Full Name" CssClass="left_top"></asp:Label>
<asp:Label ID="labelNameDisplay" runat="server" Text="Put name here" CssClass="right_top"></asp:Label>
<br />
<asp:Panel ID="panelName" runat="server" Height="240px" Visible="False" CssClass="panel_top"
style="text-align: left;">
<asp:Label ID="Label8" runat="server" CssClass="left" Text="Please allow 24 hours for name changes to take effect."></asp:Label>
<div align="center"><br />
<br />
<table>
<tr>
<td class="label_new">
<asp:Label ID="Label4" runat="server" Text="Full Name:" ToolTip="Name Displayed"></asp:Label>
</td>
<td align="left">
<asp:DropDownList ID="DropDownList1" runat="server" BorderStyle="Groove"
Font-Names="Segoe UI,Tahoma,Verdana,Arial,Times" Font-Size="100%" Height="25px"
valign="middle" Width="250px">
<asp:ListItem></asp:ListItem>
<asp:ListItem></asp:ListItem>
<asp:ListItem></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="label_new">
<asp:Label ID="Label2" runat="server" Text="First Name:"></asp:Label>
</td>
<td align="left">
<asp:TextBox ID="txtFirstName" runat="server" BorderStyle="Groove" Font-Names="Segoe UI,Tahoma,Verdana,Arial,Times" Font-Size="100%" Height="20px"
valign="middle" Width="242px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="label_new">
<asp:Label ID="Label9" runat="server" Text="Middle Name:"></asp:Label>
</td>
<td align="left">
<asp:TextBox ID="txtMiddleName" runat="server" BorderStyle="Groove" Font-Names="Segoe UI,Tahoma,Verdana,Arial,Times" Font-Size="100%" Height="20px"
valign="middle" Width="242px" onfocus="if (this.value == 'optional') { this.value=''; this.style.color='black';}" />
</td>
</tr>
<tr>
<td class="label_new">
<asp:Label ID="Label10" runat="server" Text="Last Name:"></asp:Label>
</td>
<td align="left">
<asp:TextBox ID="txtLastName" runat="server" BorderStyle="Groove" Font-Names="Segoe UI,Tahoma,Verdana,Arial,Times" Font-Size="100%" Height="20px"
valign="middle" Width="242px"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
<asp:Button ID="btnSaveChanges" runat="server" Text="Save Changes"
onclick="btnSaveChanges_Click" />
</td>
</tr>
</table>
</div>
</asp:Panel>
I have 4 panels in this format just like ACCOUNT SETTINGS on facebook.
My problem here is when I show the panel it just jump to the top of the page.
I would like to do it just as the way facebook is doing. Click and be on at the same position of where you clicked.
You can set the MaintainScrollPositionOnPostback property on your page:
Page.MaintainScrollPositionOnPostback = true;
or put it in the page declaration
<%# Page MaintainScrollPositionOnPostback="true" %>
I'm not entirely sure I what you are asking for. Facebook uses a lot of ajax style callbacks which means that the page doesn't reload using asp .net style postbacks. If you're just starting out I'd recommend you trying placing your code into an Ajax .Net UpdatePanel whilst you learn the details of Ajax / JSON / XMLHttpRequest etc.
If you're simply looking to make sure the browser window remains at the same scrollbar position after a postback then set the page to use the MaintainScrollPositionOnPostback="true" directive.

Categories

Resources