.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

using ForeignKey.ascx in the Insert page instead of ForeignKey_Edit.ascx

Posted By:      Posted Date: October 04, 2010    Points: 0   Category :ASP.Net


in my insert page the dropdown list is too long. it is slowing down my insert page.

I want to use the Hyperlink instead of the dropdown  in my insert page (exactly same like what i have in my edit page).

my insert page will have always foreign key Initialized values .

insert or update I will not allow my user to edit his foreign key (i am fine with that )


View Complete Post

More Related Resource Links

Problem with custom pages using ForeignKey.ascx & ForeignKey_Edit.ascx field templates


I have created a DynamicData website with a data model from Northwind (using Orders & Shippers tables Orders.ShipVia-> Shippers.ShipperId) I've turned scaffolding on.

I have then added a custom page by copying ListDetails.aspx from PageTemplate folder to the DynamicData\ CustomPages\Orders folder

Then I have edited the page:

And adding the following to the GridView1:


    <asp:DynamicField DataField="OrderID">
    <asp:DynamicField DataField="OrderDate">
    <asp:DynamicField DataField="ShippedDate">
    <asp:DynamicField DataField="ShipVia">

How to Access Parent Page (.aspx) control (IDs) from its child User Control (.ascx)

I have a parent .aspx page that has a asp:panel control in it, and this parent .aspx is also referencing a user control that I registered in that .aspx. Lets just call it usercontrolA.ascx for this post.The user control has a radiobuttonlist itself.Based on a selection from the radiotbuttonlist in the user control, I want to be able to hide the asp:panel in my .aspx (parent) but unfortunately I cant' get it to work:parentPanel.visible = true;  <<< I trried this in usercontrolA.ascx.csBut the user control doesn't know about the panel in the parent .aspxSo do I need to expose that somehow from the parent so that I can access it from the code behind of the child .ascx?  How?

create a form to create an ascx page and code behind for it

Is is possible to build a form, accept parameters and from THAT construct a new .ascx page AND the code behind for that page? What I'm proposing is having some code snippets that just need parameters added and can then be used to create a web user control that can be added to existing pages. This .ascx file would be a real file after creation, not dynamic every time.I don't know if I'm describing it very well, maybe someone could point me in the right direction.

how to inherit .ascx page to another .ascx page


 i have made a BaseUserControl.ascx and a ChildUserControl.ascx
file. both have its own code behind file.
So what i want,
i wanted to inharit ChildUserControl.ascx file
to BaseUserControl.ascx. so whatever in my BaseUserControl.ascx file
should be visible into the ChildUserControl.ascx,
means if i have kept a TextBox in BaseUserControl.ascx should be visible
into the ChildUserControl.ascx desing view. and it should be accessible into the ChildUserControl.ascx code behind file.

1) Is this possible, if yes then how?

2) if above is possible then How to access BaseUserControl.ascx code behind file into the ChildUserControl.ascx code behind file?

Accessing ASPX page elements from ASCX'S jquery function


Hi Friends, I need your help.

I have aspx page and in that page i registerd ascx page. i want to access the aspx page <div id = "idofdiv"> from ascx page jquery function. i have jquery function in ascx page. i want to access idofdiv in that function. how could i achive this?



Passing value from login page to ascx page


Hi Folks,

Please help me out, as I am beginner with ASP.NET.

I am using query string to pass values from page 1(log in page) to page 2 and then page 3. I have an .ascx file also, so how can I import the user name from Page1(login.aspx) to menu.ascx file. So that when I click the menu Home the value of the variable remains at the website. I am not aware of session handling thats why I am using this method to pass the valus among the various pages in website.

Thanks in Advance.

how to call button click event of ascx page in the button click event of aspx page



i'm using user control in my page.i need to call the button click event of user control in the button click event of aspx page based on some condition.is it possible?can any one help me?

how to avoid dynamic change of controls names in ascx page sharepoint


when creating webpart contols using ascx in sharepoint deployed . the webpart added to site. the controls name is page has changed. please provide detials to avoid name changes

Thanks in advance

How to change the page(aspx) title from Usercontrol(ascx) the inside the page(aspx) (asp.net 1.1) ??




I have user control(ascx) inside  the page(aspx) and from the code behind of that user control How can I change the page(aspx) title??


Note : Please my Question about asp.net 1.1


And thanks with my best regarding


jquery validation in ascx page


Following on from my post about using ascx pages for the content of the jquery tab panels.


Can I use jquery validation on each ascx page before submitting to move to the next tab panel?

I've been trying the following way, but when I click the submit button I get the error 'Object doesn't support this property or method'.


<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
    <div id="tabs">
            <li><a href="#tab1">Your Details</a></li>
            <li><a href="#tab2">Course Details</a></li>
            <li><a href="#tab3">Education & Employment</a></li>
            <li><a href="#tab4">References</a></li>
            <li><a href="#tab5">Submit Application</a></li>
        <div id="tab1">
            <asp:PlaceHolder ID="plhApp" runat="server"></asp:PlaceHolder>

problems with using jQuery for reordering groups on an ascx page


Hi all. im making a page that has its header, its footer, and its side menus all in seperate controls (ascx pages).  The reason is so i don't have to rewrite that code for every single page when only the inner content will be different.

In my Menu control there is a list of items that gets populated when the page loads from a database.  The items have an order in the database and i want to be able to reorder them by dragging and dropping.  I am using jQuery and the actual physical drag and drop is working but i am having trouble getting the new order to save in the database... atleast when it is on the ascx page.

It works when the menu is on the aspx page.

In my events.aspx page i have

<div id="contentLeft">
<asp:Repeater ID="FormGroupList" runat="server">           
        <li id="<%#Eval("FormGroupID")%>" class="itemStyle">                   
            <a class="active" href="fields.aspx?fg=<%#Eval("SectionHeading")%>"><%#Eval("SectionHeading")%></a></li>           

How to access child(.ascx) page control from parent page(.aspx) javascript


I have functionality to select All check boxes on grid rows.

Child User control is having grid with checkbox to select all rows of grid. I want to select individual cell html from each row when I select all rows when checkbox 'select all' is clicked and place it into textbox which is in Parent page.

This textbox can only be in parent page.

So i need to call child(.ascx) page control from parent page(.aspx) using javascript as follows.

function CheckUncheckChildren(event)
        var childChkBoxes = document.getElementById('<%=gvUserDetails.ClientID %>').getElementsByTagName("input");
        var childChkBoxCount = childChkBoxes.length;
        var evtelem = (isIE())?event.srcElement:event.currentTarget;
        if(evtelem.checked == true)
            for(var i = 0; i<childChkBoxCount; i++)

cannot pass the value from .ascx to .aspx page.


Dear All,

I have created a UserControl [uscAuditTeam.ascx], there I have a Dictionary list and I added some values.

I want to pass the dictionary value to AuditTracking.aspx page. But it shows the null value. Cany any one help?


Code :

In uscAuditTeam.ascx

Dictionary<int, string> objAuditorTeam =

how to use gridview usercontrol (Ascx) and sql pass to aspx page


how to use gridview usercontrol (Ascx) and sql pass to aspx page

Sys.InvalidOperationException: Could not find UpdatePanel... on ascx.page


Hi, I have three UpdatePanels on my ascx page. In first I have gridview, in second I have DetailView. DetailsView is in a Panel, after click on buttom -

Panel show or hide. All works fine. I added third Panel, new Buttom , inside Panel I put  UpdatePanel and I would like the some function as in DetailView - show or hide Panel.

After click on buttom I can see this error


-Sys.InvalidOperationException: Could not find UpdatePanel with ID 'xxxxxxxxxxx. If it is being updated dynamically then it must be inside another UpdatePanel.


I tried many examples, whitch I found on the internet (move Buttom on page - change its position, add UpdateMode="Conditional" to the UpdatePanel), but without any resolution.

Please, can anybody help me?




My code

  <asp:Panel ID="Panel6" runat="server" CssClass="myCssClass">
       <asp:Button ID="Button1" runat="server"
        CausesValidation="False" meta:resourcekey="Button1Resource1"
        UseSubmitBehavior="False" Text="Show&qu

Code works on aspx but not ascx


Not sure which category to put this question in, so I will put it in here.

Just to give you an idea of the layout of my solution, I have the main project, along with 2 class libraries, BLL and DAL.  (Business Logic Layer and Data Access Layer)

The BLL refers to the DAL and the main project refers to the BLL.

I had a test website and the code worked fine, but the same code will not work on the real project. The only difference is that in the test project, the code was on an aspx code behind, whereas in the real project, it is an ascx code behind (Web User Control )

The code is:

Dim connectionString As String = ConfigurationManager.ConnectionStrings("ASPNETDBConnectionString").ConnectionString
        Dim recordEntry As New UserRecord(connectionString)
        recordEntry.UserName = "TestName"
        recordEntry.BMI = bMI
        recordEntry.BMR = bMR
        recordEntry.FTM = fTM
        recordEntry.TDEE = tDEE
        recordEntry.TodayDate = dateForToday

Dim connectionString As String = ConfigurationManager.ConnectionStrings("ASPNETDBConnectionString").ConnectionString

Detecting Edit or Insert Page


I am coding a .cs file that handles the metadata for a particular table. I am putting a custom validation that allows me to update or insert only if the PubMedID is not already in the database. This would be easy except that the PMID should also be allowed to be null as some of the references in the database were not from PubMed. So i perform a query on the database to see if there is already an identical PMID in the database. This works great when using Insert. However, when using Edit, it does not. The PMID is already in the database because the one currently being edited has the same PMID!!! So I know exactly how to change my query etc. However, I do not know how to tell from inside this Edit/Insert agnostic page, which one it is being called from. Thanks for your help! 

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend