I want to convert the gridview function to rows. I have a header saying "Content Manager" and I have their username displayed below it. I want the username to be able to be displayed to the right of the "content manager" text. Thank you!
<asp:SqlDataSource ID="SqlDataSource19" runat="server" ConnectionString="<%$ ConnectionStrings:IntranetDB %>" SelectCommand="SELECT [id], [username], [grouping], [isContentManager], [CMRegion] FROM [Permissions] WHERE (([grouping] = 'marketing') AND ([isContentManager] = 'yes'))">
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="id" DataSourceID="SqlDataSource19">
<Columns>
<asp:BoundField DataField="username" HeaderText="Content Manager" SortExpression="username" />
</Columns>
</asp:GridView>
<ej:Grid ID="Grid1" runat='server'></ej:Grid>
You can try DataList and set its RepeatDirection to Horizontal.
<form id="form1" runat="server">
<div style="float: left">
<asp:Label runat="server">Content Manager: </asp:Label>
</div>
<div style="float: left">
<asp:DataList ID="DataList1"
RepeatDirection="Horizontal"
RepeatLayout="Table"
RepeatColumns="0" runat="server">
<ItemTemplate>
<%# Eval("UserName") %>
</ItemTemplate>
</asp:DataList>
</div>
</form>
Related
When the user selects a row in my datagrid view the label outside the datagridview does not update.
Here is my datagridview
As you can see in visual studio the value of the selected row is captured. However visually it does not update.
Here is what my datagrid code looks like.
<asp:UpdatePanel ID="uplPanel" runat="server" >
<ContentTemplate>
<asp:GridView ID="gvInventario" runat="server" AutoGenerateColumns="false" AllowSorting="true" ShowFooter="false" DataKeyNames="componente_id, ubicacion_id, proveedor_id" PageSize="20"
ShowHeaderWhenEmpty="true" AllowPaging="True" OnPageIndexChanging="gridView_PageIndexChanging" OnSelectedIndexChanged="OnSelectedIndexChanged" OnRowDataBound="OnRowDataBound"
CellPadding="3" AllowColumResize="True" onsorting="grdDetails_Sorting" GridLines="None" CssClass="mGrid" PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt">
<Columns>
Here is what the code for the labels outside the grid looks like
<div id="ChangeQuantitySection" class="menusection">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="Label7" runat="server" Text="Cambiar la cantidad" CssClass="second-menu-title"></asp:Label>
<br/>
<b><asp:Label ID="Label3" runat="server" Text="Proveedor: "></asp:Label></b>
<asp:Label ID="lblProveedor" runat="server" Text=""></asp:Label>
<br/>
<b><asp:Label ID="Label2" runat="server" Text="Tipo: "></asp:Label></b>
<asp:Label ID="lblType" runat="server" Text=""></asp:Label>
<br/>
<b><asp:Label ID="lblQtRequired" runat="server" Text="Cantidad requerida: "></asp:Label></b>
<asp:TextBox width="50px" ID="txtQtRequired" runat="server" TextMode="Number" min="0" step="1" Value="0"></asp:TextBox>
<br/>
<asp:Button class="btn btn-primary" ID="Button1" runat="server" Text="Validar" OnClick="Confirm_purchase_order_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
Check if you use correct lable IDs. Because in your example labels ids are not consistent. Update the correct labels in your event.
I change UpdateMode="Conditional" to UpdateMode="Always" Thanks to the answer I found here how to update a control in another updatepanel?
I am getting the following error.
HttpStatusCode:500
Name:Sys.WebForms.PageRequestManagerServerErrorException
Message: Sys.WebForms.Page.RequestManagerServerErrorException
Failed to Load viewstate. The control tree into which viewstate is being
loaded must match the control tree that was used to save viewstate during
the previous request.
The scenario is as follows I have a Gridview that is bound after a DropDownList is selected. Then you can click a row on the Gridview and a ModalPopupExtender pops up. There is another GridView in the popup. If I edit that Gridview and then exit the ModalPopupExtender, and then select a different value on the DropDownList which generates the original Gridview I get the error.
DropDownList
<asp:DropDownList ID="SearchCategoryDD" runat="server" DataSourceID="InductionCategoriesDS" DataTextField="CompentencyCategory" DataValueField="CompentencyCategoryID" AutoPostBack="True" OnDataBound="SearchCategoryDD_DataBound" OnSelectedIndexChanged="SearchCategoryDD_SelectedIndexChanged"></asp:DropDownList>
Gridview when Databound with new data causes error
<asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate>
<asp:GridView runat="server" ID="SkillsXXX" OnRowDataBound="SkillsXXX_OnRowDataBound" >
<Columns>
<asp:TemplateField>
<EditItemTemplate>
<asp:LinkButton runat="server" ID="SelectLBXX" Visible="False" OnClick="SelectLBXX_OnClick"></asp:LinkButton>
<asp:Label runat="server" ID="EmployeeXXXXD" Text='<%# Bind("EmployeeID") %>' Visible="False"></asp:Label>
</EditItemTemplate>
......
...
ModalPopupExtender with Gridview
<asp:Button ID="EditSupplierContactPopupBTN" runat="server" Text="" Style="visibility: hidden;" />
<ajaxToolkit:ModalPopupExtender ID="EditSupplierContactMPE" runat="server" CancelControlID="EditSupplierContactCancelBTN"
TargetControlID="EditSupplierContactPopupBTN" PopupControlID="EditSupplierContactPanel" PopupDragHandleControlID="EditSupplierContactHeader"
Drag="true" BackgroundCssClass="ModalPopupBG">
</ajaxToolkit:ModalPopupExtender>
<asp:Panel ID="EditSupplierContactPanel" runat="server" CssClass="PopupPNL" Style="display: none"> <!-- Style="display: none" -->
<div class="PopupHeader" id="EditSupplierContactHeader">
<div class="PopupControls">
<asp:Button ID="EditSupplierContactCancelBTN" runat="server" Text="Close" />
</div>
Edit Truck Driver
</div>
<div class="PopupBody">
<asp:UpdatePanel ID="UpdatePanel3" runat="server"><ContentTemplate>
<asp:GridView ID="Competancies2GV" runat="server" AutoGenerateColumns="False" DataKeyNames="SkillsMatrixID" Width="100%">
<Columns>
<asp:TemplateField InsertVisible="False" SortExpression="SkillsMatrixID">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("SkillsMatrixID") %>'></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="EditSkillsMatrixLB" runat="server" CommandArgument='<%# Eval("SkillsMatrixID") %>' OnCommand="EditSkillsMatrixLB2_Command">Edit</asp:LinkButton>
<asp:HiddenField runat="server" ID="SkillsMatrixIDHF" Value='<%# Bind("SkillsMatrixID") %>'/>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="CompentencyCategory" HeaderText="Category" SortExpression="CompentencyCategory">
</asp:BoundField>
<asp:BoundField DataField="CompentencyName" HeaderText="Compentency" SortExpression="CompentencyName">
</asp:BoundField>
...........
........
.....
I have tried the loading the Datatable from ViewState in the LoadViewState method. I still get the error.
LoadViewState
protected override void LoadViewState(object earlierState)
{
base.LoadViewState(earlierState);
dataTable = (DataTable)ViewState["dataTable2"];
SkillsMatrixGV.DataSource = dataTable;
compentencyDataTable = (DataTable) ViewState["CompentencyDataTable2"];
Competancies2GV.DataSource = compentencyDataTable;
Competancies2GV.DataBind();
......
...
if I put EnableViewState="false" into the page or the GridView the error goes away but my GridView in the ModalPopupExtender does not update.
I am trying to load images from the folder UploadImages combined with image name for the particular query
my gridview code is as follows:
<asp:GridView ID="gvDetails" runat="server" AllowPaging="false" PageSize="50" ShowHeader="false" GridLines="None" AutoGenerateColumns="false" Width="100%" OnPageIndexChanging="gvDetails_PageIndexChanging">
<PagerSettings Mode="NumericFirstLast" PageButtonCount="4" FirstPageText="First" LastPageText="Last" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<h2><asp:Label runat="server"><%#Eval("Ads_Title")%></asp:Label></h2>
<h5><asp:Label runat="server" Text='<%#Eval("Ads_Posted_Date")%>'></asp:Label>, Posted by <asp:Label runat="server" Text='<%#Eval("Ads_State")%>'></asp:Label></a></h5>
<div class="blog-para">
<p class="para">
<image src='../UploadImages/<%#Eval("Busines_Image") %>' Width="150px" />
<p><asp:Label runat="server" Text='<%#Eval("Cat_Name")%>'></asp:Label></p>
<p>Pokect Listing: <asp:Label runat="server" Text='<%#Eval("PocketListing")%>' /> </p>
<p><asp:Label Text='<%# Eval("Ads_Hot_Normal") == "false" ? "<image src='images/premium_logo.png' alt='Premium'" : " " %>'runat="server" /></p>
<div class="read_more">
<a class="btn" href='AdsDetails.aspx?AddId=<%#Eval("main_ID") %>'>Read More</a>
</div>
</p>
</div>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Every time i run the webapp it states faied to load the resource.
This is might be happening because GridView control is losing View. For more details yo can try this Link
I am trying to create a dropdown with check-box using textbox and popup control extender but i am getting this error whenever i run it:
Error: 'Sys.Extended.UI' is null or not an object'.
I am trying to make as simple as possible but not sure what am i missing here. Here is the code:
<asp:TextBox ID="ddl_TextLog" runat="server" AutoPostBack="true" BackColor="#FFFFCC" Style="background-color: #FFCC66" Width="250px"></asp:TextBox>
<asp:PopupControlExtender ID="TextBox1_PopupControlExtenderLog" runat="server" Enabled="True" ExtenderControlID="" TargetControlID="ddl_TextLog" PopupControlID="pnl_Log" OffsetY="22"></asp:PopupControlExtender>
<asp:Panel ID="pnl_Log" runat="server" Height="180px" Width="250px" BorderStyle="Solid" BorderWidth="2px" Direction="LeftToRight" ScrollBars="Auto" BackColor="#FFFFCC" Style="display: none">
<asp:CheckBoxList ID="CheckBoxList_Log" runat="server" DataSourceID="SqlDataSource_Log" DataTextField="MDE" DataValueField="MDE" AutoPostBack="True" OnSelectedIndexChanged="CheckBoxList_Log_SelectedIndexChanged"></asp:CheckBoxList>
<asp:SqlDataSource ID="SqlDataSource_Log" runat="server" ConnectionString="<%$ ConnectionStrings:DCR-DWH-MS-01-DA2 %>" SelectCommand=" SELECT DISTINCT MDE FROM myTable ORDER BY MDE ASC"></asp:SqlDataSource>
</asp:Panel>
i had to use this and fixed my issue:
<ajaxToolkit:ToolkitScriptManager runat="server" ID="ToolkitScriptManager1" />
I want to show Images in my datalist. Image URLs are stored in my database. For some reason urls can't be retrived from my database.
Anyone knows what Am I missing? Here is my code.
<asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1" RepeatColumns="3" Width="100%">
<ItemTemplate>
<asp:Image runat="server" ImageUrl="http://mywebsite.com/folder/{0}" Width="100%" />
</ItemTemplate>
</asp:DataList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [url] FROM [MyDatabase]"></asp:SqlDataSource>
There is problem in binding image to image control. Try this.
<asp:Image runat="server" ImageUrl='<%# "http://mywebsite.com/folder/" + Eval("url") %>' Width="100%" />
Or
<asp:Image runat="server" ImageUrl='<%# "~/folder/" + Eval("url") %>' Width="100%" />