Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ASP.NET

Posted on 2009-06-30
6
Medium Priority
?
237 Views
Last Modified: 2012-05-07
I have a page with 2  panels

The first panel loads data in a  Radgrid(TELERIK control) with 4 fields(id,name,city,state)  and one button (SELECT).When user clicks SELECT  that particular row is highlighted.
Panel 2 has ID and NAME text boxes which should be read only.
Now my question Is I want the values of the ID,Name(from panel1) for the highlighted row to be sent to the ID,Name in panel2 and make panel1 visible=false.

How can I do this??I appreciate if I can get some ideas....

Below is the sample code.

'Loads the grid with data
    Protected Sub BtnSearchDealers_Click(ByVal sender As Object, ByVal e As EventArgs) Handles BtnSearchDealers.Click
 
        Dim dealerResults As BusinessEntity() = CrmHelper.GetAccounts(Me.TxtDealerNumber.Text.Trim(), Me.TxtZipCode.Text.Trim(), CType(ViewState("SearchAccountType"), AccountType), Me.TxtDealerName.Text.Trim())
 
        ' TODO: Store properly
        Session("test_dset") = dealerResults
 
        Me.RGSearchResults.DataSource = dealerResults
        Me.RGSearchResults.DataBind()
 
    End Sub
'Select row is highlighted
    Protected Sub RGSearchresults_ItemCommand(ByVal sender As Object, ByVal e As Telerik.WebControls.GridCommandEventArgs) Handles RGSearchResults.ItemCommand
 
        Select Case e.CommandName.ToLower()
            Case "select"
                RaiseEvent DealerSelected(sender, e.CommandArgument)
        End Select
 
    End Sub

Open in new window

0
Comment
Question by:onebite2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 
LVL 20

Expert Comment

by:ddayx10
ID: 24750407
Not enough information. Lets see your ASPX code where the panels are, and any other relevant code. Unless something made it very messy I would likely use JavaScript to handle this issue.
0
 
LVL 12

Expert Comment

by:Adam
ID: 24753916
I'm not familiar with the Radgrid control, but something like below should work.

If you want it to be faster (i.e. no page reload) surround both panels in an ASP.Net Ajax UpdatePanel


    Protected Sub RGSearchresults_ItemCommand(ByVal sender As Object, ByVal e As Telerik.WebControls.GridCommandEventArgs) Handles RGSearchResults.ItemCommand
 
        Select Case e.CommandName.ToLower()
            Case "select"
                txtID.Text = {Get the selected ID here}
                txtName.Text = {Get the selected Name here}
                panel1.Visible = false
                panel2.Visible = true
        End Select
 
    End Sub

Open in new window

0
 

Author Comment

by:onebite2
ID: 24754815
@ddayx10
Below is the aspx code with 2 panels....

@Cyber-spy

I have 2 panels where in the first panel uses a User control Dealer Search .....The above code I pasted is from that Usercontrol page......Now my question is how will I carry the ID and Name to another page???

I appreciate if any one can help me.I can explain again if you are not clear with the scenario ..


 <table border="0" cellspacing="20" style="width: 694px">
   <tr>
     <td>
      <asp:panel id="panel1" runat="server" style="width:784" groupingtext="PICK A DEALER" Font-Bold="true" visible="false">
           <uc1:DealerSearchControl ID="uxDealerSearchControl" runat="server" />
      </asp:panel>
      <asp:panel id="panel2" runat="server" style="width:784" groupingtext="ADD INFO" Font-Bold="true" visible="false">
        <table width="400" border="1" align="center">
          <tr>
            <td>
                <font face="arial" size="2"><b>First Name:</b></font>
            </td>
            <td>
             <span style="text-transform: uppercase"><asp:TextBox ID="txtFName" runat="server"></asp:TextBox>             </span>
             <asp:RequiredFieldValidator ID="FNameReqdValidator" runat="server" ControlToValidate="txtFName"
                    Display="Dynamic" ErrorMessage="Please enter a First Name." Font-Bold="True"
                    Font-Names="Tahoma" Font-Size="8pt"></asp:RequiredFieldValidator>
            </td>
          </tr>
          <tr>
            <td>
                <font face="arial" size="2"><b>Last Name:</b></font>
            </td>
            <td>
             <span style="text-transform: uppercase"><asp:TextBox ID="txtLName" runat="server"></asp:TextBox>             </span>
             <asp:RequiredFieldValidator ID="LNameReqdValidator" runat="server" ControlToValidate="txtLName"
              Display="Dynamic" ErrorMessage="Please enter a Last Name." Font-Bold="True" Font-Names="Tahoma"
              Font-Size="8pt"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
                <font face="arial" size="2"><b>Email:</b></font>
            </td>
            <td>
             <span style="text-transform: uppercase"><asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>             </span>
             <asp:RequiredFieldValidator ID="EmailReqdValidator" runat="server" ControlToValidate="txtEmail"
                    Display="Dynamic" ErrorMessage="Please enter an Email address." Font-Bold="True"
                    Font-Names="Tahoma" Font-Size="8pt"></asp:RequiredFieldValidator>
                 <asp:Label ID="lblerrormsg" runat="server" ></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <font face="arial" size="2"><b>DealerID:</b></font>
            </td>
            <td>
             <span style="text-transform: uppercase"><asp:TextBox ID="txtDealerID" runat="server"></asp:TextBox>              </span>
            </td>
        </tr>
        <tr>
            <td>
                <font face="arial" size="2"><b>DealerName:</b></font>
            </td>
            <td>
            <span style="text-transform: uppercase"><asp:TextBox ID="txtDealerName" runat="server" MaxLength="6">             </asp:TextBox></span>
            </td>
        </tr>
        <tr>
            <td colspan="2" >
                <asp:Button runat="server" ID="btnAdd" Text="Add" Width="100px" />
            </td>
            <td>
              <asp:Button runat="server" ID="btnDifferentDealer" Text="Pick Different Dealer" Width="100px"/>
            </td>
        </tr>
    </table>
 
       </asp:panel>
      </td>
     </tr>
  </table>

Open in new window

0
 
LVL 20

Accepted Solution

by:
ddayx10 earned 2000 total points
ID: 24761257
Sorry busy week. The user control really makes this a complex issue. Glad I asked to see what was going on there. I really don't have time to make a full scale example of this. It looks like you are on the right track already. Can't just tell you...here are 5 lines of code that will sove this for you, sorry.

You need to:
1) Get the data you want (id and name?) in the itemcommand
2) Create a commandeventhandler on the usercontrol
3) call the commandevent passing it the data you want to go to the 2nd panel
4) create event to listen on the main page
5) update your panel1/panel2 visibility and the controls inside panel2 using this event

All the details to do this can be found at:
http://www.codeproject.com/KB/user-controls/Page_UserControl.aspx
Look under the Event Driven Communication section

BTW this is a great page and will show you several ways to do what you are trying to do. But looking at your code you are already using events so this seems the logical progression. Reading the whole page will make it easier to understand.

0
 
LVL 12

Expert Comment

by:Adam
ID: 24761353
Alternatively, if your DealerSearchControl  is always used like this (and won't be used in a significantly different way elsewhere) you could encapsulate all this functionality into the DealerSearchControl , rather than having to make the control raise its own events to be handled by the host page.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

718 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