Display .htm files content in .aspx page control

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shashi shekhar singh
    New Member
    • Aug 2009
    • 30

    #16
    Originally posted by Frinavale
    Hi Shashi,

    Please take the time to research the problem before you post your question. The experts here are more than willing to help you with a specific problem but you have to do your part to learn the basics.

    Once you've tried to solve the problem and you need some help, ask for help on your specific problem.
    Respected Sir....

    i have a gridview inside them a radiobuttonlist taken by me.
    Code:
    <asp:GridView ID="QuestionView1" runat="server" AutoGenerateColumns="False" 
                Width="262px" PageSize="3" AllowPaging="True">
            <PagerSettings NextPageText="" PreviousPageText="" Visible="False" />
            <Columns>
                <asp:TemplateField HeaderText="Questions">
                <ItemTemplate> 
                 <tr> 
                    <td> <iframe src="<%# Container.DataItem %>" height="450" width="800"></iframe></td> 
                 </tr> 
               <tr>
                 <td align="center" bgcolor="Yellow">
                <asp:RadioButtonList ID="Answerlist" runat="server" RepeatDirection="Horizontal" ID="radiolist"  Font-Bold="True" ForeColor="#0099FF" TextAlign="Left">
                 <asp:ListItem Value="001" Text="Answer 1" ></asp:ListItem>
                 <asp:ListItem Value="002" Text="Answer 2"></asp:ListItem>
                 <asp:ListItem Value="003" Text="Answer 3"></asp:ListItem>
                 <asp:ListItem Value="004" Text="Answer 4"></asp:ListItem>
    
                 </asp:RadioButtonList>
                 </td>
                 
                 </tr>
              </ItemTemplate> 
                
                
                </asp:TemplateField>
            </Columns>
                        
            </asp:GridView>
    but when itry to findout whic radio button has been clicked it shows error, i am really tired .
    Code:
    RadioButtonList rdo = (RadioButtonList)QuestionView1.Rows[0].FindControl("Answerlist");
            Response.Write("value has been selected" + rdo.SelectedValue + "<br/>");
    looking for your reply....
    From Shashi shekhar singh
    Last edited by Frinavale; Sep 4 '09, 01:17 PM. Reason: Please post code in [code] ... [/code] tags. Added code tags.

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #17
      Hmmm,

      What you've posted looks fine...what is the error?
      Are you calling the DataBind method for the GridView somewhere near the beginning of the ASP page life cycle (like in the Page Load event)?

      -Frinny

      PS. I'm not a Sir ;)

      Comment

      • shashi shekhar singh
        New Member
        • Aug 2009
        • 30

        #18
        Originally posted by Frinavale
        Hmmm,

        What you've posted looks fine...what is the error?
        Are you calling the DataBind method for the GridView somewhere near the beginning of the ASP page life cycle (like in the Page Load event)?

        -Frinny

        PS. I'm not a Sir ;)
        yes sir..
        i bind the gridview on page _load and different button click of page like next ,previous, first and last button...
        help me out looking for your reply..

        Comment

        • Frinavale
          Recognized Expert Expert
          • Oct 2006
          • 9749

          #19
          Move the databind to the PreRender event instead.

          Comment

          • shashi shekhar singh
            New Member
            • Aug 2009
            • 30

            #20
            Originally posted by Frinavale
            Move the databind to the PreRender event instead.
            thank you very much sir, i have got it..that i needed.

            Comment

            • shashi shekhar singh
              New Member
              • Aug 2009
              • 30

              #21
              how to determine which button is clicked

              Respected Sir,
              thanx a lot for your support with me.
              This time I have a gridview with multiple button controls inside gridview item template.now i have to check it, out side of the gridview button click event to know which button has been clicked. i am sending my .aspx page plz check it and help me out..
              Code:
              <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                          AllowPaging="True" Height="197px" PageSize="1" Width="406px">
                          <PagerSettings Visible="False" />
                          <Columns>
                              <asp:TemplateField HeaderText="Select Questions">
                                  <ItemTemplate>
                                      <table class="style1">
                                          <tr>
                                              <td class="style2">
                                                  <asp:Button ID="Button1" runat="server" Height="26px" Text="1" Width="46px" 
                                                      onclick="Button1_Click" />
                                              </td>
                                              <td class="style3">
                                                  <asp:Button ID="Button2" runat="server" Height="28px" Text="2" Width="49px" 
                                                      onclick="Button2_Click" />
                                              </td>
                                              <td class="style4">
                                                  <asp:Button ID="Button3" runat="server" Height="29px" Text="3" Width="48px" 
                                                      onclick="Button3_Click" />
                                              </td>
                                              <td class="style4">
                                                  <asp:Button ID="Button4" runat="server" Height="27px" Text="4" Width="50px" 
                                                      onclick="Button4_Click" />
                                              </td>
                                              <td class="style5">
                                                  <asp:Button ID="Button5" runat="server" Height="26px" Text="5" Width="48px" 
                                                      onclick="Button5_Click" />
                                              </td>
                                          </tr>
                                          <tr>
                                              <td class="style2">
                                                  <asp:Button ID="Button6" runat="server" Height="28px" Text="6" Width="45px" 
                                                      onclick="Button6_Click" />
                                              </td>
                                              <td class="style3">
                                                  <asp:Button ID="Button7" runat="server" Height="29px" Text="7" Width="46px" 
                                                      onclick="Button7_Click" />
                                              </td>
                                              <td class="style4">
                                                  <asp:Button ID="Button8" runat="server" Height="26px" Text="8" Width="49px" 
                                                      onclick="Button8_Click" />
                                              </td>
                                              <td class="style4">
                                                  <asp:Button ID="Button9" runat="server" Height="30px" Text="9" Width="49px" 
                                                      onclick="Button9_Click" />
                                              </td>
                                              <td class="style5">
                                                  <asp:Button ID="Button10" runat="server" Height="26px" Text="10" Width="47px" 
                                                      onclick="Button10_Click" />
                                              </td>
                                          </tr>
                                          <tr>
                                              <td class="style2">
                                                  <asp:Button ID="Button11" runat="server" Height="27px" Text="11" Width="44px" 
                                                      onclick="Button11_Click" />
                                              </td>
                                              <td class="style3">
                                                  <asp:Button ID="Button12" runat="server" Height="27px" Text="12" Width="47px" 
                                                      onclick="Button12_Click" />
                                              </td>
                                              <td class="style4">
                                                  <asp:Button ID="Button13" runat="server" Height="29px" Text="13" Width="50px" 
                                                      onclick="Button13_Click" />
                                              </td>
                                              <td class="style4">
                                                  <asp:Button ID="Button14" runat="server" Height="30px" Text="14" Width="47px" 
                                                      onclick="Button14_Click" />
                                              </td>
                                              <td class="style5">
                                                  <asp:Button ID="Button15" runat="server" Height="28px" Text="15" Width="45px" 
                                                      onclick="Button15_Click" />
                                              </td>
                                          </tr>
                                          <tr>
                                              <td class="style2">
                                                  <asp:Button ID="Button16" runat="server" Height="31px" Text="16" Width="47px" 
                                                      onclick="Button16_Click" />
                                              </td>
                                              <td class="style3">
                                                  <asp:Button ID="Button17" runat="server" Height="32px" Text="17" Width="45px" 
                                                      onclick="Button17_Click" />
                                              </td>
                                              <td class="style4">
                                                  <asp:Button ID="Button18" runat="server" Height="29px" Text="18" Width="45px" 
                                                      onclick="Button18_Click" />
                                              </td>
                                              <td class="style4">
                                                  <asp:Button ID="Button19" runat="server" Height="30px" Text="19" Width="47px" 
                                                      onclick="Button19_Click" />
                                              </td>
                                              <td class="style5">
                                                  <asp:Button ID="Button20" runat="server" Height="32px" Text="20" Width="49px" 
                                                      onclick="Button20_Click" />
                                              </td>
                                          </tr>
                                      </table>
                                  </ItemTemplate>
                              </asp:TemplateField>
                              <asp:TemplateField HeaderText="Your Question">
                              <ItemTemplate>
                              <iframe src="<%# Container.DataItem %>" style="height: 369px; width: 690px;" ></iframe>
                              
                              </ItemTemplate>
                              
                              </asp:TemplateField>
                          </Columns>
                      </asp:GridView>
               <asp:Button ID="Button21" runat="server" Height="38px" onclick="Button21_Click"  Text="Start Test" Width="99px" />
              as shown above i want to check it which button has been clicked on
              Code:
              Button21_Click(object sender, eventargs e)
              {
              
              }
              plz help me out..waiting for your reply..
              Last edited by Frinavale; Sep 9 '09, 01:08 PM. Reason: Please post code in [code]...[/code] tags. Added code tags.

              Comment

              • Frinavale
                Recognized Expert Expert
                • Oct 2006
                • 9749

                #22
                This one's a bit tricky.

                The only time I've really done something like this I was using dynamic columns and dynamic TemplateFields. The code I implemented for the TemplateField would handle the onclick event and then raise it again so that the page code could handle it.

                My guess would be that you'll have to use the GridView.RowCom mand event. Remember that the first parameter is the Object that raised the event (which could be your button, but could be something else too)

                -Frinny

                Comment

                • shashi shekhar singh
                  New Member
                  • Aug 2009
                  • 30

                  #23
                  Originally posted by Frinavale
                  This one's a bit tricky.

                  The only time I've really done something like this I was using dynamic columns and dynamic TemplateFields. The code I implemented for the TemplateField would handle the onclick event and then raise it again so that the page code could handle it.

                  My guess would be that you'll have to use the GridView.RowCom mand event. Remember that the first parameter is the Object that raised the event (which could be your button, but could be something else too)

                  -Frinny
                  When Button out side of the gridview has been clicked then how to determine which button raises the event to to give the source of iframe. ok if i found them by giving the condition
                  on submit button click...
                  Code:
                  if(gridview1.pageindex==0 && btn.text="1")
                  {
                    btn1.enabled =false;
                  }
                  then it is true only for one postback when next button inside the gridview clicked then it's enabled property =true.
                  i want to do when submit button clicked then the buutton inside the gridview who raises the src to iframe should be disabled for application lifetime.
                  Is it possible plz tel me how..it will be possible.
                  and also tell me how to raise the row_command event in gridview
                  Code:
                   <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                              AllowPaging="True" Height="197px" PageSize="1" Width="406px" 
                              onrowcommand="GridView1_RowCommand">
                              <PagerSettings Visible="False" />
                              <Columns>
                                  <asp:TemplateField HeaderText="Select Questions">
                                      <ItemTemplate>
                  </ItemTemplate>
                  Code:
                  void GridView1_RowCommand(objectsender,GridViewCommandEventArgs e)
                      {
                          foreach (GridViewRow row in GridView1.Rows)
                          {
                              Button one = row.FindControl("Button1") as Button;
                              Button two = row.FindControl("Button2") as Button;
                              Button three = row.FindControl("Button3") as Button;
                              Button four = row.FindControl("Button4") as Button;
                              Button five = row.FindControl("Button5") as Button;
                              Button six = row.FindControl("Button6") as Button;
                              Button seven = row.FindControl("Button7") as Button;
                              Button eight = row.FindControl("Button8") as Button;
                              Button nine = row.FindControl("Button9") as Button;
                              Button ten = row.FindControl("Button10") as Button;
                              Button eleven = row.FindControl("Button11") as Button;
                              Button twelve = row.FindControl("Button12") as Button;
                              Button thirteen = row.FindControl("Button13") as Button;
                              Button fourteen = row.FindControl("Button14") as Button;
                              if (GridView1.PageIndex == 0 && one.Text == "1")
                              {
                                  one.Enabled = false;
                  
                              }
                              if (GridView1.PageIndex == 1 && two.Text == "2")
                              {
                                  two.Enabled = false;
                  
                              }
                              if (GridView1.PageIndex == 2 && three.Text == "3")
                             
                              {
                                  three.Enabled = false;
                  
                              }
                              string name = e.CommandName;
                              switch (e.CommandName)
                              { 
                                  case "1":
                                      one.Enabled = false;
                                      break;
                                  case "2":
                                      two.Enabled = false;
                                      break;
                              
                              }
                          }
                  Last edited by Frinavale; Sep 11 '09, 01:07 PM. Reason: Please post code in [code] ... [/code] tags. Added code tags.

                  Comment

                  • Frinavale
                    Recognized Expert Expert
                    • Oct 2006
                    • 9749

                    #24
                    I should have looked at your code more closely.
                    I though you were using CommandField buttons not actual Buttons.
                    Please look into seeing if CommandField controls could be any help to you.

                    Comment

                    Working...