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" />
Related
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>
I am getting this error
"Both DataSource and DataSourceID are defined on 'DataListCity'. Remove one definition."
This is the code from my Masterpage that is causing the error
<asp:DataList ID="DataListCity" runat="server" Width="100%"
onitemcommand="DataListCity_ItemCommand" CellPadding="4"
ForeColor="#333333" DataSourceID="SqlDataSource1">
<ItemTemplate>
CityId:
<asp:Label ID="CityIdLabel" runat="server" Text='<%# Eval("CityId") %/>
<br />
CityName:
<asp:Label ID="CityNameLabel" runat="server" Text='<%# Eval("CityName")%>' />
<br />
<br />
</ItemTemplate>
</asp:DataList>
<asp:SqlDataSource
ConnectionString="<%$ ConnectionStrings:HotelConnString %>"
ID="SqlDataSource1" runat="server"
SelectCommand="SELECT [CityId], [CityName], [Description] FROM [Categories]">
</asp:SqlDataSource>
Remove your binding code from cs if you have written in code behind because you can bind only by code behind or from design not both at same time
Remove these lines from code behind
DataListCity.DataSource=somesource;
DataListCity.DataBind();
I have a GridView with multiple rows (records).
<asp:DropDownList ID="DDLActionStatus" runat="server" DataSourceID="LDSActionStatus" AppendDataBoundItems="True" DataTextField="Title" DataValueField="ReportActionStatusID" SelectedValue='<%# Bind("ReportActionStatusID") %>' Enabled='<%# (int)Eval("ReportActionStatusID") == 1 %>' Width="100%" />
<asp:Button ID="BtnActionStatus" runat="server" CommandName="Update" Text="Save & Close" OnClientClick="return confirm('Are you sure? Once set, this can not be changed.')" Width="100%" />
<asp:CompareValidator ID="CVActionStatus" runat="server" Operator="NotEqual" ValueToCompare="1" Type="Integer" ControlToValidate="DDLActionStatus" SetFocusOnError="true" ErrorMessage="Must set one of the Completion statuses" />
It works fine for one row, however if there are multiple rows it validates all rows together.
I understand it happens because the ControlToValidate="DDLActionStatus" repets for each row.
I tried to set the ID like ID="DDLActionStatus<%# Eval('ReportActionStatusID') %>" and the ControlToValidate="DDLActionStatus<%# Eval('ReportActionStatusID') %>", but it doesn't work.
I know I could write a custom validation, but is there an easy solution that doesn't require a custom validation?
What I need is to each row be validate independent.
Thanks for help.
The issue is not with the ControlToValidate property. Add a ValidationGroup property to each control in a row with same value. But, make sure to keep it unique for all rows in your GridView. See following example.
<asp:DropDownList ID="DDLActionStatus" runat="server" ValidationGroup="MyGroup1" DataSourceID="LDSActionStatus" AppendDataBoundItems="True" DataTextField="Title" DataValueField="ReportActionStatusID" SelectedValue='<%# Bind("ReportActionStatusID") %>' Enabled='<%# (int)Eval("ReportActionStatusID") == 1 %>' Width="100%" />
<asp:Button ID="BtnActionStatus" runat="server" ValidationGroup="MyGroup1" CommandName="Update" Text="Save & Close" OnClientClick="return confirm('Are you sure? Once set, this can not be changed.')" Width="100%" />
<asp:CompareValidator ID="CVActionStatus" runat="server" ValidationGroup="MyGroup1" Operator="NotEqual" ValueToCompare="1" Type="Integer" ControlToValidate="DDLActionStatus" SetFocusOnError="true" ErrorMessage="Must set one of the Completion statuses" />
Make sure ValidationGroup is different for each row.
All the best!
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%" />
I'm having some problem binding the value of a date picker to a textbox in formview asp.net. I've tried to a put a date picker in ASP.NET and JavaScript which calls on a class file in calendar.css so far it can display the date but if I tried to insert it to a record it always return null. So how can I bind it so it can add the date value to the record?
Help would be much appreciated.
Thanks in advance ;)
Here's a sample of my code. I want to bind the 'input text' to the 'dateborrowedTextBox'
<InsertItemTemplate>
Book Title:
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="booktitleDataSource" DataTextField="booktitle"
DataValueField="bookid" SelectedValue='<%# Bind("bookid", "{0}") %>'>
</asp:DropDownList>
<asp:SqlDataSource ID="booktitleDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:LibrarySystemConnectionString %>"
SelectCommand="SELECT [bookid], [booktitle] FROM [TblBooks]">
</asp:SqlDataSource>
<br />
Employee PIN:
<asp:TextBox ID="employeeidTextBox" runat="server"
Text='<%# Bind("employeeid") %>' />
<br />
Department:
<asp:TextBox ID="departmentTextBox" runat="server"
Text='<%# Bind("department") %>' />
<br />
Date borrowed:
<%--<asp:TextBox ID="dateborrowedTextBox" runat="server"
Text='<%# Bind("dateborrowed") %>' />--%>
<input type="text" name="dateborrowedTextBox" readonly="readonly" id="dateborrowedTextBox">
<a href="#" onclick="cdp1.showCalendar(this, 'dateborrowedTextBox'); return false;">Date Picker
</a>
<br />
<asp:Button ID="InsertButton" runat="server" CausesValidation="True"
CommandName="Insert" Text="Insert" />
<asp:Button ID="InsertCancelButton" runat="server" CausesValidation="False"
CommandName="Cancel" Text="Cancel" />
</InsertItemTemplate>
The client-side IDs of the ASP.NET controls are not going to be translated as cleanly as you are hoping.
You need to do one of two things, both of which can be found here.
Date Picker
Or, you could add a Link control and set the actions that way (the link I gave you does it with an image control). It's up to you.
Just found my answer. ASP.NET cant read Javascript normally so CT100 and some dollar sign will do the trick ;)
Date Picker