Solved

Enabling scorlling in user control(*.ascx)

Posted on 2010-11-22
19
761 Views
Last Modified: 2012-05-10
Hi,
 I am working on ASP.NET MVC Application, we have a page called 'SAP Request' and on left side of this page ,one more page(actually a *.ascx control called hrdata.ascx) which comes if i keep mouse on the control(as shown in the screenshot).

The problem is that this control (HR Data) is very big and have lots of text boxes and  does not have scroll functionaliy (to see all controls by scrolling) at this moment. Due to this , all controls are not visible to user on this left page(control called hrdata.ascx).

Can we enable it and how..It seems javascript work with html? Please help me ASAP with code.


Thanks,
Deepak




 untitled.PNG(ScreenShot) Code-of-SAPRequest-Page.txt
Code-of-HRData.ascx.txt
0
Comment
Question by:krdeepak123
  • 11
  • 4
19 Comments
 
LVL 2

Expert Comment

by:jzkidding
Comment Utility
do you need fix it using java script
0
 
LVL 16

Expert Comment

by:Swapnil Piparia
Comment Utility
Hi krdeepak123,
 
           Put your user control content in to div and apply style sheet through class as shown in below code snippet.

        You can change height and width in stylesheet as per you requirement. Height and Width is specifies your viewing area and beyond that it will show scrollbars.

Thanks,
Netswap.
<div class="scroll">

your content

..

..

..

..

</div>



<style type="text/css">

<!--

div.scroll {

height: 200px;

width: 300px;

overflow: auto;

}

-->

</style>

Open in new window

0
 

Author Comment

by:krdeepak123
Comment Utility
Hi jzkidding:

Yes, also if page postback then position of scroll bar should be persistent.

Thanks
0
 

Author Comment

by:krdeepak123
Comment Utility
Hi netswap,

  May you please fit your code snippet my my code which i provided using the attachments earlier so that i can directly copy paste and test...

Thanks
0
 

Author Comment

by:krdeepak123
Comment Utility
Hi netswap,

I am currenlty trying to follow your code but where should i put <style /> tag as this is not showing in indent of VS window.

Your Code:
<div class="scroll">
your content
..
..
..
..
</div>

<style type="text/css">
<!--
div.scroll {
height: 200px;
width: 300px;
overflow: auto;
}
-->
</style>
 

My updated Code:

<asp:Content ID="hrData" ContentPlaceHolderID="HRDataContentArea" runat="server" >    
    <div class ="scroll" style ="   >
    <% Html.RenderPartial("HRData"); %>    
    </div>              
</asp:Content>

Now where i need to write the <style />tag

May u please fit this thing in my attachments which i send in my first comment in form of questions..

Wating for your positive reply ASAP as I m on hold in frint of my visual studio window.

Thanks,
Deepak



 
0
 
LVL 16

Expert Comment

by:Swapnil Piparia
Comment Utility
try this, rather than class put style in the div tag.

<asp:Content ID="hrData" ContentPlaceHolderID="HRDataContentArea" runat="server" >    
    <div style ="height: 200px;width: 300px;overflow: auto;"  >
    <% Html.RenderPartial("HRData"); %>    
    </div>              
</asp:Content>
0
 

Author Comment

by:krdeepak123
Comment Utility
Hi,

Can somebody help me?

Thanks,
Deepak
0
 
LVL 16

Expert Comment

by:Swapnil Piparia
Comment Utility
Hi Deepak,
 
     Can you please let me know what is the problem with my code snippet? Have you tried it?

Thanks,
Netswap.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:krdeepak123
Comment Utility
Hi netswap,

This code snippet give me scrolling but not on the user control (HRData) instead on the other page SAP WebAccess which has grid(a html table with rows)...Actually the control HRData is placed on this SAPWebAccess page and it is dock undock if user puts mouse cursor on left side and scrolling should be present in this control only as this control has lots of text boxes below.


plesee see the code and if possible may you give me correct code so scrolling comes in hrdata control only and not on other pages.

Also i m stuck to this problem since yesterday so plz help me urgently.

Thanks,
Deepak

 original-code-of-sqpwebaccessreq.txt original-code-of-hrdata.ascx.txt
0
 

Author Comment

by:krdeepak123
Comment Utility
hi netswap,

please see the application after putting your latest code.

untiled.png-- you can see scrolling comes on sapwebaccesspage.aspx and not on user control.
also in next screenshot usercontrol which dock(i.e. visible) only when user put mouser cursor on HRData control on left side until it disappars.

untitled.png-- this is how this cntrol visible once i put the cursor on HRData on left side and scrolling should be present here and not like untitled.png


hope you undertand the problem now.

also , in my last comment, i provided you the code for both HRData.ascx and sapwebaccessrequest.aspx

i guess we need to pu div tag on hrdata.ascx code rather than sapwebaccessrequest.aspx as u did in ur last comment.

waiting for your positive reply asap. stuck on this problem since last 3 days so please help asap if possible with correct code so that by copy paste on my side i can test it and confirm.

thanks,
deepak after your latest code.Untitled2.png
0
 

Author Comment

by:krdeepak123
Comment Utility
This is done now myself.

I put the Div tag inside the code of HRData.ascx like

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<ul id="lefttabs">
    <li id="hrdata">
        <ul class="lefttab" >
            <li class="headerleft"><a href="#" class="dockleft">Dock</a><a href="#" class="undockleft">Undock</a>HR
                Data</li>
            <div style ="height: 800px;width: 200px;overflow: auto;"  >
            <p id="frmPersonnel">
                <label for="CompanyCode">
                    Company:</label><br />
                <input type="text" id="CompanyCode" class="personnel" readonly="readonly" maxlength="8"
                    size="8" />
                &nbsp;
                <input type="text" id="CompanyText" class="personnel" readonly="readonly" maxlength="8"
                    size="8" />
                <br />
                <label for="PersonnelAreaCode">
                    Area:</label><br />
                <input type="text" id="PersonnelAreaCode" class="personnel" readonly="readonly" maxlength="8"
                    size="8" />
                &nbsp;<input type="text" id="PersonnelAreaDescription" class="personnel" readonly="readonly"
                    maxlength="30" size="30" />
                <br />
                <label for="PersonnelSubAreaCode">
                    Sub Area:</label><br />
                <input type="text" id="PersonnelSubAreaCode" class="personnel" readonly="readonly"
                    maxlength="8" size="8" />
                &nbsp;<input type="text" id="PersonnelSubAreaDescription" class="personnel" readonly="readonly"
                    maxlength="30" size="30" />
                <br />
                <label for="EmployeeGroupCode">
                    Employee Group:</label><br />
                <input type="text" id="EmployeeGroupCode" class="personnel" readonly="readonly" maxlength="8"
                    size="8" />
                &nbsp;<input type="text" id="EmployeeGroupDescription" class="personnel" readonly="readonly"
                    maxlength="30" size="30" />
                <br />
                <label for="EmployeeSubGroupCode">
                    Employee Subgroup:</label><br />
                <input type="text" id="EmployeeSubGroupCode" class="personnel" readonly="readonly"
                    maxlength="8" size="8" />
                &nbsp;<input type="text" id="EmployeeSubGroupDescription" class="personnel" readonly="readonly"
                    maxlength="30" size="30" />
                <br />
                <label for="CostCenterCode">
                    Cost Center:</label><br />
                <input type="text" id="CostCenterCode" class="personnel" readonly="readonly" maxlength="8"
                    size="8" />
                &nbsp;<input type="text" id="CostCenterDescription" class="personnel" readonly="readonly"
                    maxlength="30" size="30" />
                <br />
                <label for="SupervisorId">
                    Supervisor Id:</label><br />
                <input type="text" id="Text1" class="personnel" readonly="readonly" maxlength="8"
                    size="8" />
                &nbsp;<input type="text" id="Text2" class="personnel" readonly="readonly" maxlength="30"
                    size="30" />
                <br />
                <label for="OrgUnitCode">
                    OrgUnitCode:</label><br />
                <input type="text" id="OrgUnitCode" class="personnel" readonly="readonly" maxlength="8"
                    size="8" />
                &nbsp;<input type="text" id="OrgUnitDescription" class="personnel" readonly="readonly"
                    maxlength="30" size="30" />
                <br />
                <label for="PositionCode">
                    Position:</label><br />
                <input type="text" id="PositionCode" class="personnel" readonly="readonly" maxlength="8"
                    size="8" />
                &nbsp;<input type="text" id="PositionDescription" class="personnel" readonly="readonly"
                    maxlength="30" size="30" />
                <br />
                <label for="JobCode">
                    Job:</label><br />
                <input type="text" id="JobCode" class="personnel" readonly="readonly" maxlength="8"
                    size="8" />
                &nbsp;<input type="text" id="JobDescription" class="personnel" readonly="readonly"
                    maxlength="30" size="30" />
                <br />
                <label for="JobCode">
                    Supervisor:</label><br />
                <input type="text" id="ManagerCode" class="personnel" readonly="readonly" maxlength="8"
                    size="8" />
                &nbsp;<input type="text" id="ManagerName" class="personnel" readonly="readonly" maxlength="30"
                    size="30" />
                <br />
                <label for="EmploymentStatus">
                    EmploymentStatus:</label>
                <input type="text" id="EmploymentStatus" class="personnel" readonly="readonly" maxlength="8"
                    size="8" />
                <br />
                <label for="EmploymentStatus">
                    Managers:</label>
                <select id="Managers" multiple="multiple" readonly="readonly">
                    <option>Manager 1</option>
                </select>
                <input type="hidden" id="LockStatus" class="personnel" readonly="readonly" maxlength="8"
                    size="8" />
                <input type="hidden" id="UserGroup" class="personnel" readonly="readonly" maxlength="8"
                    size="8" />
                <input type="hidden" id="UserType" class="personnel" readonly="readonly" maxlength="8"
                    size="8" />
            </p>
        </div>
        </ul>
    </li>
</ul>

Thanks,
Deepak
0
 

Author Comment

by:krdeepak123
Comment Utility
my soltuion accepted by myself.
0
 
LVL 16

Accepted Solution

by:
Swapnil Piparia earned 100 total points
Comment Utility
Hi,
 
      krdeepak has used my solution only however he has modify his code based on his requirement. Actual solution remain same which is  comment #34186970 where I mentioned him to apply style ="height: 200px;width: 300px;overflow: auto;" to div and put his content inside it which he wants scrollbar.
 
Thanks,
NetSwap.
0
 

Author Comment

by:krdeepak123
Comment Utility
Hi Admin Team

Ok. Thanks :-)
 I would request you to please close this question now.

Thanks,
Deepak
0
 

Author Comment

by:krdeepak123
Comment Utility
Hi Admin Team,

  Please assign the points to netswap as netswap's original soltuions was used as he mentioned.

  Thanks netawap for your great and timely help otheriwse i could nto solve this problem.:-)

Thanks,
Deepak
0
 

Author Closing Comment

by:krdeepak123
Comment Utility
done..
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now