ASP.Net AJAX TabControl - asp.net

I have placed an AJAX Tabcontrol on my page.
Inside the TabControl, I also placed a gridview.
<cc1:TabContainer id="tabconLandTransPlan" runat="server" Height="300px" ActiveTabIndex="0" AutoPostBack="True">
<cc1:TabPanel runat="server" ID="tabMasterPlan" HeaderText="Master Plan" >
<HeaderTemplate>
<span style="font-size: 8pt; font-family: Arial">Master Plan</span>
</HeaderTemplate>
<ContentTemplate>
<asp:GridView id="gvBuffer" runat="server" Width="100%" AutoGenerateColumns="False">
<Columns>
<asp:TemplateField HeaderText="Type of Services">
<HeaderStyle Width="26%"></HeaderStyle>
<ItemTemplate>
<asp:Label id="Label1" runat="server" Text='<%# EVAL("code_desc") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Tariff Code">
<HeaderStyle Width="4%" HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# EVAL("res_code") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</cc1:TabPanel>
When I retrieve the gridview, the gridview boundaries extend beyond the Tab Control boundaries. How Can I ensure that the gridview will be just within the boundaries of the tab control? The height of the Gridview is extending beyond the tab control. The width is just fine.
Thanks.

I may have found the answer to this little problem.
Apparently, the ajax tab control follows the size (height) of the controls inside it.
So what I did was set the height of the tabcontrol to Nothing (VB.Net).
Setting it to zero or any other percentage (conversion) values would otherwise throw an error.
Thanks to those who viewed.

Increase the height of the tab control!

Related

How to add a button control dynamically into a GridView cell ? VB.NET

Look, it´s simple. I have a GridView which is populated with data from my database.
What I want is put a button in each cell that contains a specific datum.
Pls, look the image below. It describes exactly what I want
In VB.NET, pls! =)
Example Image
Thanks very much!
You are going to need to define the button control inside of the <Columns> section of your GridView markup, like this:
<asp:gridview id="CustomersGridView" runat="server">
<columns>
<asp:boundfield datafield="DateColumn" headertext="Date"/>
<asp:TemplateField>
<HeaderTemplate>
Positive
</HeaderTemplate>
<ItemTemplate>
<asp:Label id="LabelPositive" runat="server" Text='<%# Eval("PositiveColumn")%>' />
<br />
<asp:Button id="ButtonPositive" runat="server" Text="Show" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
Negative
</HeaderTemplate>
<ItemTemplate>
<asp:Label id="LabelNegative" runat="server" Text='<%# Eval("NegativeColumn")%>' />
<br />
<asp:Button id="ButtonNegative" runat="server" Text="Show" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
Neutral
</HeaderTemplate>
<ItemTemplate>
<asp:Label id="LabelNeutral" runat="server" Text='<%# Eval("NeutralColumn")%>' />
<br />
<asp:Button id="ButtonNeutral" runat="server" Text="Show" />
</ItemTemplate>
</asp:TemplateField>
<asp:boundfield datafield="NoCommentsColumn" headertext="No Comments"/>
<asp:boundfield datafield="TotalColumn" headertext="Total"/>
</columns>
</asp:gridview>
Note: The datafield and Eval() calls are bound to made up names like NeutralColumn and NoCommentsColumn, substitute those names with your real database field names.
You need to add while data binding the grid. Look for an event call and handle your code there.
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound.aspx

CheckBoxList OnSelectedChange event not fired

I Have this type of code in Gridview in UpdatePanel..
Now when I Checked CheckBox then it fire its OnSelectedIndexChanged event But When I Select two or three CheckBox and then uncheck any checkbox among selected then it's
OnSelectedIndexChanged event is not fired..why this happen
<asp:Label ID="lbltempCity" runat="server" Text="City"></asp:Label>
<asp:CheckBoxList ID="lst" AutoPostBack="true" runat="server" Width="100px" Height="100px" BorderWidth="1px" BackColor="White" OnSelectedIndexChanged="hello">
<asp:ListItem>Test1</asp:ListItem>
<asp:ListItem>Test2</asp:ListItem>
<asp:ListItem>Test1</asp:ListItem>
<asp:ListItem>Test2</asp:ListItem>
</asp:CheckBoxList>
<asp:DropDownExtender ID="DropDownExtender1" runat="server" DropArrowWidth="300px" TargetControlID="lbltempCity" DropDownControlID="lst">
</asp:DropDownExtender>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblCity" runat="server" Text='<%# Eval("tempCity") %>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="15%" />
</asp:TemplateField>
I tested the code it is working fine. May be cause of problem is in grid or any other control in your page. post the full code so that we can help.

In asp.net how to add meno or dropdown control in asp.net?

Data gridview bind the recored with data set.Gird view consist the column "Compnayname"
whenever user click on the column of gridview "Company name" then menu or dropdown control will be display.
so how to add dropdown or menu control in gridview.
I want to data display in grid view control and user click on company name then Menu will be display which contain the information like Send msg, save company detail.
You have to make Template Column
<asp:TemplateField HeaderText="Compnayname">
<ItemTemplate>
<asp:DropDownList ID="ddlCompany" runat="server">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
here isthe complete GRIDView
<asp:GridView ID="grdList" runat="server" AutoGenerateColumns="False" OnRowCancelingEdit="grdList_RowCancelingEdit" OnRowEditing="grdList_RowEditing" OnRowUpdating="grdList_RowUpdating" OnPageIndexChanging="grdList_PageIndexChanging" AllowPaging="true">
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:Label SkinID="OneColLabel" ID="lblName" runat="server" HeaderText="Edit" />
</HeaderTemplate>
<ItemTemplate>
<asp:LinkButton ID="lnbEdit" runat="server" CommandName="Edit" Text="Edit" />
</ItemTemplate>
<EditItemTemplate>
<asp:LinkButton ID="lnbUpdate" runat="server" CommandName="Update" Text="Update" />
<asp:LinkButton ID="lnbCancel" runat="server" CommandName="Cancel" Text="Cancel" />
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Name">
<ItemTemplate>
<asp:Label ID="lblName" runat="server" Text='<%# Eval("Name") %>' />
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="drpEditName" runat="server" />
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
You have to bind Dropdownlist on code behind

ASP.NET - Fill/update row in gridview when a textbox loses focus

I have the following gridview that is inside an updatepanel:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="ButtonAdd" runat="server" OnClick="ButtonAdd_Click" Text="Novo Artigo" />
<asp:GridView ID="Dados" runat="server" AutoGenerateColumns="False" CssClass="Grid">
<Columns>
<asp:TemplateField HeaderText="Artigo">
<ItemTemplate>
<asp:TextBox ID="Artigo" runat="server"></asp:TextBox>
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
TargetControlID="Artigo"
PopupControlID="PanelArtigos"
>
</asp:ModalPopupExtender>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Descrição">
<ItemTemplate>
<asp:TextBox ID="Descricao" runat="server" Width="300px"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="IVA">
<ItemTemplate>
<asp:TextBox ID="IVA" runat="server" Width="40px" Enabled="false"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Pr. Unit.">
<ItemTemplate>
<asp:TextBox ID="PU" runat="server" Width="50px"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="% Desc.">
<ItemTemplate>
<asp:TextBox ID="Desconto" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="UN">
<ItemTemplate>
<asp:TextBox ID="UN" runat="server" Width="50px" Enabled="false"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Quant.">
<ItemTemplate>
<asp:TextBox ID="Quantidade" runat="server" Width="50px"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Total Liquido">
<ItemTemplate>
<asp:TextBox ID="TotalLiquido" runat="server" Enabled="false"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="RemoveArtigo" runat="server" OnClick="RemoveArtigo_Click">Remover
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<HeaderStyle Font-Size="Small" />
<RowStyle Font-Size="Small" CssClass="grid" />
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
As you can see, i have some textbox's.
When i change a value in a textbox, for example, the Desconto value, and leave that textbox, i want that the row where i am to be updated, using the new value present in the textbox. It's like a TextChanged or onBlur, but inside the update panel it's not working.
what is the best way to do it?
I am using VB.NET.
Thank you.
EDIT:
When adding the OnTextChanged="Desconto_TextChanged" i receive this compilation error:
Compilation Error Description: An
error occurred during the compilation
of a resource required to service this
request. Please review the following
specific error details and modify your
source code appropriately.
Compiler Error Message: BC30456:
'Desconto_TextChanged' is not a member
of 'ASP.index_aspx'.
Source Error:
Line 204:
Line 205:
Line 206:
Line 207:
Line 208:
Source File:
C:\inetpub\wwwroot\Facturas\Facturas\index.aspx
Line: 206
TextBox controls will not initiate a postback by default. you can set AutoPostBack to true for each textbox control.
I believe the event you need is TextChanged. Like lincolnk said, you need AutoPostBack set to True for the textbox to fire the postback. Then, inside the event handler, call Dados.DataBind() to reload the GridView's data.

<asp:TemplateField Boxes Disappearing

I've got a text box that just disappeared. When I add another templateField anywhere on the page, this one bizarelly disappears. Anyone know what might be up?
<asp:TemplateField HeaderText="Summary" SortExpression="summary">
<ItemTemplate>
<asp:Label ID="lblSummary" runat="server" Text='<%# Bind("summary") %>'></asp:Label>
</ItemTemplate>
<ItemTemplate>
<asp:TextBox ID="txtSummary" TextMode="MultiLine" Width="500" Height="100" runat="server" Text='<%# Bind("summary") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<AnotherEdit>
I hope you don't take this wrong, and I mean no offense, but it seems like you're missing some of the basic concepts and need a good place to learn them.
Please check out the following article so that you fully understand how to use TemplateFields as opposed to a normal BoundField or a Command field. I think once you "get" it, your disappearing item issues will clear up because you'll be able to see it on your own.
http://www.asp.net/learn/data-access/tutorial-12-cs.aspx
</AnotherEdit>
You can't have more than one ItemTemplate in a TemplateField. You can have an EditItemTemplate and an ItemTemplate, though...
Edit - Added
The ItemTemplate shows when you're in normal display mode.
The EditItemTemplate shows when you're in edit mode
InsertItemTemplate shows when you're in Insert mode.
For any column in a GridView (or field in a FormView or field in a DetailsView) there can only be one TemplateField.
Within that TemplateField, there can only be one ItemTemplate, one EditItemTemplate, and one InsertItemTemplate (and not all three are required but all three are recommended.)
If you want the TextBox to show up next to the label in the normal non-edit mode, you would put the text box within the existing ItemTemplate as follows:
<ItemTemplate>
<asp:Label ID="lblSummary" runat="server" Text='<%# Bind("summary") %>'>
</asp:Label>
<asp:TextBox ID="txtSummary" TextMode="MultiLine" Width="500" Height="100" runat="server" Text='<%# Bind("summary") %>'>
</asp:TextBox>
</ItemTemplate>
However, the norm is to have the label when in read mode, and a text box when in edit or update mode like shown below:
<asp:TemplateField HeaderText="Summary" SortExpression="summary">
<ItemTemplate>
<asp:Label ID="lblSummary" runat="server" Text='<%# Bind("summary") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtSummary" TextMode="MultiLine" Width="500" Height="100" runat="server" Text='<%# Bind("summary") %>'>
</asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="txtSummary" TextMode="MultiLine" Width="500" Height="100" runat="server" Text='<%# Bind("summary") %>'>
</asp:TextBox>
</InsertItemTemplate>
</asp:TemplateField>
You have multiple "ItemTemplate" declarations in there. There should be only one.

Resources