Click here to Skip to main content
15,889,335 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionASP.NET Server Controls are not displaying in my website Pin
S Jayakar11-Apr-10 16:12
S Jayakar11-Apr-10 16:12 
AnswerRe: ASP.NET Server Controls are not displaying in my website Pin
Venkatesh Mookkan11-Apr-10 16:26
Venkatesh Mookkan11-Apr-10 16:26 
GeneralRe: ASP.NET Server Controls are not displaying in my website Pin
S Jayakar11-Apr-10 16:37
S Jayakar11-Apr-10 16:37 
GeneralRe: ASP.NET Server Controls are not displaying in my website Pin
Venkatesh Mookkan11-Apr-10 17:16
Venkatesh Mookkan11-Apr-10 17:16 
AnswerRe: ASP.NET Server Controls are not displaying in my website Pin
S Jayakar12-Apr-10 4:27
S Jayakar12-Apr-10 4:27 
QuestionAnyone know of asp.net software/tutorial for creating a video library? Pin
Goalie3511-Apr-10 10:37
Goalie3511-Apr-10 10:37 
AnswerRe: Anyone know of asp.net software/tutorial for creating a video library? Pin
Not Active11-Apr-10 13:13
mentorNot Active11-Apr-10 13:13 
QuestionHow can I get the correct row in Repeater from LinkButton click? Pin
DeepToot11-Apr-10 7:00
DeepToot11-Apr-10 7:00 
I have a page with a Repeater. The rows from the Repeater after setting its datasource is as follows:

Row1:
LinkButton | Column1 | Column2
- asp:Panel with HtmlTable and additional repeater

Row2:
LinkButton | Column1 | Column2
- asp:Panel with HtmlTable andadditional repeater

The initial load of the data only shows the row with LinkButton, the Panel and HtmlTable is to show only when the LinkButton of that row is selected. If there are two rows, the first linkbutton is clicked, it shows the Panel and HtmlTable for that row - if row 2's panel and HtmlTable is showing it needs to collapse and hide and only show the selected rows data.

Hope this makes sense so far.

The problem I am having is that now matter what Linkbutton I click, I am only getting the first instance of the items in the repeater. Meaning, I click row 2 and can only seem to get the reference to row 1's Panel and HtmlTable.

I guess my initial question would be what is the correct way to be able to get the right control based on what linkbutton is clicked?


Here is my click event for the linkbutton - what this does is once clicked it just needs to show the Panel associated with that link button.

The code below is how I am trying to get a reference to the controls for that row.

I put a HiddenField in the repeater that will tell me in the code below if we are to Expand the Panel (visible) or Collapse the Panel (hide it).

When I click the first LinkButton on Row 1 here is the ID I get back from my controls:
LinkButton returns:
ctl00_MainContent_tabContainer_tabSearchFilings_SD1_rptResults_ctl01_lnkButton
HiddenField
ctl00_MainContent_tabContainer_tabSearchFilings_SD1_rptResults_ctl01_hidrptCourtOrderResults

The panel that is brought back when I do a FindControl (see code below) is this:
Panel returns:
ctl00_MainContent_tabContainer_tabSearchFilings_SD1_rptResults_ctl01_pnlExpand

So we match, but this is the first row.

Clicking the second rows LinkButton produces this result:
LinkButton returns:
ctl00_MainContent_tabContainer_tabSearchFilings_SD1_rptResults_ctl02_lnkButton <-- WE now have ct102!

Panel returns:
ctl00_MainContent_tabContainer_tabSearchFilings_SD1_rptResults_ctl01_hidrptCourtOrderResults<-- this is still row 1's reference

so now that I cannot get the ct102's reference I can only show row 1's Panel, not row 2's...

Any idea what I am missing? Hope this made sense, ask if it didn't.

Here are two screenshots to help explain what I am talking about.
http://i327.photobucket.com/albums/k459/Welborn08/singleRows.gif[^]
http://i327.photobucket.com/albums/k459/Welborn08/expanded_row1.gif[^]


protected void lnkButton_Click(object sender, EventArgs e)<br />
        {<br />
            //find hidden box<br />
            HiddenField _hid = (HiddenField)rptResults.Items[0].FindControl("hidrptCourtOrderResults");<br />
<br />
            if (null != _hid)<br />
            {<br />
                //find panel<br />
                Panel _pnlExpand = (Panel)rptResults.Items[0].FindControl("pnlExpand");<br />
<br />
<br />
                if (_hid.Value == "Expand")<br />
                {<br />
<br />
                    Repeater _rptResults = (Repeater)rptResults.Items[0].FindControl("rptCourtOrderResults");<br />
<br />
                    if (null != _rptResults)<br />
                    {<br />
                        #region Real Data<br />
                        //get required values to pass to stored procedure<br />
                        //find hidden box<br />
                        HiddenField _hidCaseOwnerID = (HiddenField)rptResults.Items[0].FindControl("hidCaseOwnerID");<br />
                        HiddenField _hidCaseNum = (HiddenField)rptResults.Items[0].FindControl("hidCaseNum");<br />
                        HiddenField _hidCaseStatus = (HiddenField)rptResults.Items[0].FindControl("hidCaseStatus");<br />
<br />
                        string caseOwnId = "";<br />
                        string casenum = "";<br />
                        string casestatus = "";<br />
<br />
                        if (null != _hidCaseOwnerID)<br />
                        {<br />
                            caseOwnId = _hidCaseOwnerID.Value.ToString();<br />
                        }<br />
<br />
                        if (null != _hidCaseNum)<br />
                        {<br />
                            casenum = _hidCaseNum.Value.ToString();<br />
                        }<br />
<br />
                        if (null != _hidCaseStatus)<br />
                        {<br />
                            casestatus = _hidCaseStatus.Value.ToString();<br />
                        }<br />
<br />
                        DataSet dsCourtData = fetchCourtData(caseOwnId, casenum, casestatus);<br />
<br />
                        if (dsCourtData.Tables.Count > 0)<br />
                        {<br />
                            _rptResults.DataSource = dsCourtData;<br />
                            _rptResults.DataMember = "Table1";<br />
                            _rptResults.DataBind();<br />
                        }<br />
<br />
                        //try to show hidden td<br />
                        _pnlExpand.Visible = true; <-- this should be row2's pnlExpand but only row1 reference is returning<br />
                        #endregion                        <br />
                    }<br />
<br />
                    _hid.Value = "Collapse";<br />
                }<br />
                else<br />
                {<br />
                    _pnlExpand.Visible = false;<br />
                    _hid.Value = "Expand";<br />
                }<br />
<br />
            }<br />
<br />
<br />
        }

AnswerRe: How can I get the correct row in Repeater from LinkButton click? Pin
DeepToot11-Apr-10 14:02
DeepToot11-Apr-10 14:02 
QuestionHow to implement message queing in C# Pin
EMMADO11-Apr-10 6:16
EMMADO11-Apr-10 6:16 
AnswerRe: How to implement message queing in C# Pin
Not Active11-Apr-10 7:00
mentorNot Active11-Apr-10 7:00 
GeneralRe: How to implement message queing in C# Pin
EMMADO12-Apr-10 2:35
EMMADO12-Apr-10 2:35 
GeneralRe: How to implement message queing in C# Pin
Not Active12-Apr-10 10:23
mentorNot Active12-Apr-10 10:23 
QuestionUsing PDFLibNet.dll Problem Pin
en.Mahdi11-Apr-10 2:30
en.Mahdi11-Apr-10 2:30 
AnswerRe: Using PDFLibNet.dll Problem Pin
Abhijit Jana11-Apr-10 2:41
professionalAbhijit Jana11-Apr-10 2:41 
GeneralRe: Using PDFLibNet.dll Problem Pin
en.Mahdi12-Apr-10 2:09
en.Mahdi12-Apr-10 2:09 
AnswerRe: Using PDFLibNet.dll Problem Pin
Alacky6-Jan-11 20:24
Alacky6-Jan-11 20:24 
AnswerRe: Using PDFLibNet.dll Problem Pin
raveenthilanka22-Apr-11 22:36
raveenthilanka22-Apr-11 22:36 
QuestionHow to set ReadOnly for a GridView column in C#? Pin
jzurbo7710-Apr-10 17:13
jzurbo7710-Apr-10 17:13 
AnswerRe: How to set ReadOnly for a GridView column in C#? Pin
Brij10-Apr-10 18:52
mentorBrij10-Apr-10 18:52 
AnswerRe: How to set ReadOnly for a GridView column in C#? Pin
R. Giskard Reventlov10-Apr-10 20:03
R. Giskard Reventlov10-Apr-10 20:03 
Questionrandom string generator Pin
vibhum dubey10-Apr-10 16:55
vibhum dubey10-Apr-10 16:55 
AnswerRe: random string generator Pin
Not Active10-Apr-10 17:34
mentorNot Active10-Apr-10 17:34 
Questionasp radiobutton displaying too wide on page. Pin
Steve Holdorf10-Apr-10 14:27
Steve Holdorf10-Apr-10 14:27 
AnswerRe: asp radiobutton displaying too wide on page. Pin
Brij10-Apr-10 19:01
mentorBrij10-Apr-10 19:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.