This is a migrated thread and some comments may be shown as answers.

Unable to access the imagebuttons in the maltipageview

1 Answer 22 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Raj
Top achievements
Rank 1
Raj asked on 15 Jul 2010, 08:33 PM
HI,

I implemented radtab inside radgrid. I have have couple of image buttons and asp.net gridview inside RadPageView. in codebehind when i am trying to access those imagebuttons or gridview with id I am getting error like  The name 'imgbtnNotesCancel' does not exist in the current context  for gridview  The name 'gvNotes' does not exist in the current context. Please see the image below. Here is my code. WHat causing the problem. Please help me to fix this. (i tried it by replacing gridview with radgrid still same issue.)

.aspx file

<EditFormSettings EditFormType="Template">
                                <FormTemplate>
                                    <table id="Table1" cellspacing="1" cellpadding="1">
                                        <tr>
                                            <td>
                                                <telerik:RadTabStrip runat="server" ID="RadTabStrip1" Orientation="HorizontalTop"
                                                    SelectedIndex="0" MultiPageID="RadMultiPage1">
                                                    <Tabs>
                                                        <telerik:RadTab Text="Task Data" PageViewID="RadPageView1">
                                                        </telerik:RadTab>
                                                        <telerik:RadTab Text="Notes" PageViewID="RadPageView2">
                                                        </telerik:RadTab>
                                                    </Tabs>
                                                </telerik:RadTabStrip>
                                                <telerik:RadMultiPage runat="server" ID="RadMultiPage1" SelectedIndex="0">
                                                    <telerik:RadPageView runat="server" ID="RadPageView1">
                                                        <table id="Table3" cellspacing="1" cellpadding="1" width="250" border="0">
                                                            <tr>
                                                                <td>
                                                                </td>
                                                                <td>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td>
                                                                    Clarify Account Nbr:
                                                                </td>
                                                                <td>
                                                                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval( "Clarify Account Nbr" ) %>'>
                                                                    </asp:TextBox>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td>
                                                                    Site ID:
                                                                </td>
                                                                <td>
                                                                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Eval( "Site ID") %>' TabIndex="1">
                                                                    </asp:TextBox>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td>
                                                                    Quote ID:
                                                                </td>
                                                                <td>
                                                                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Eval( "Quote ID") %>' TabIndex="2">
                                                                    </asp:TextBox>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td>
                                                                    EDP Created?:
                                                                </td>
                                                                <td>
                                                                    <asp:CheckBox ID="CheckBox1" runat="server" Text='<%# Eval( "EDP Created?") %>' TabIndex="3">
                                                                    </asp:CheckBox>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td align="right" colspan="2">
                                                                    <asp:Button ID="Button1" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                                                        runat="server" CommandName='Update'></asp:Button
                                                                    <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                                                        CommandName="Cancel"></asp:Button>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </telerik:RadPageView>
                                                    <telerik:RadPageView runat="server" ID="RadPageView2">
                                                        <table id="Table2" cellspacing="1" cellpadding="1" width="250" border="0">
                                                            <tr>
                                                                <td>
                                                                    <legend><b>Add Notes</b></legend>
                                                                    <table id="Tablenotes">
                                                                        <tr>
                                                                            <td align="left">
                                                                                Note Type :
                                                                                <asp:DropDownList ID="DropDownList1" runat="server">
                                                                                </asp:DropDownList>
                                                                            </td>
                                                                            <td align="left">
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td align="left" colspan="2">
                                                                                Note Description
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td align="left">
                                                                                <asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" Rows="2" Width="650px"></asp:TextBox>
                                                                            </td>
                                                                            <td>
                                                                                   
                                                                                <asp:ImageButton ID="ImageButton1" OnClick="btnAddNote_Click" runat="server" ToolTip="Add Note"
                                                                                    ImageUrl="~/Images/add-icon.png" />
                                                                                <asp:ImageButton Visible="false" ToolTip="Update" OnClick="imgbtnNotesUpdate_Click"
                                                                                    ID="ImageButton4" runat="server" ImageUrl="~/Images/accept-icon.png" />
                                                                                <asp:ImageButton Visible="false" ToolTip="Cancel" OnClick="imgbtnNotesCancel_Click"
                                                                                    ID="ImageButton5" runat="server" ImageUrl="~/Images/delete-icon.png" />
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td>
                                                                    <div style="overflow: auto; height: 160px">
                                                                        <asp:GridView ID="GridView1" BorderColor="#004000" runat="server" AutoGenerateColumns="false"
                                                                            BackColor="White" BorderWidth="1px" BorderStyle="Solid" CellSpacing="0" Width="100%"
                                                                            OnSelectedIndexChanged="gvNotes_SelectedIndexChanged" OnRowDataBound="gvNotes_RowDataBound">
                                                                            <HeaderStyle Height="20px" BackColor="#004000" Font-Size="8pt" Font-Bold="True" ForeColor="White"
                                                                                HorizontalAlign="Center" BorderColor="White" BorderWidth="0px" />
                                                                            <PagerSettings Mode="NumericFirstLast"></PagerSettings>
                                                                            <RowStyle ForeColor="#000000" Font-Size="8pt" HorizontalAlign="Left" BorderWidth="1px"
                                                                                BorderColor="#004000" />
                                                                            <AlternatingRowStyle Font-Size="8pt" ForeColor="#000000" BackColor="#F5F5E9" BorderWidth="1px"
                                                                                BorderColor="#004000" />
                                                                            <PagerStyle HorizontalAlign="Right" Font-Bold="true" Font-Size="8pt" />
                                                                            <Columns>
                                                                                <asp:TemplateField Visible="false">
                                                                                    <ItemTemplate>
                                                                                        <asp:Label ID="lblonID" runat="server" Text='<%# Bind("onID") %>'></asp:Label>
                                                                                    </ItemTemplate>
                                                                                    <ItemStyle HorizontalAlign="Left" />
                                                                                </asp:TemplateField>
                                                                                <asp:BoundField HeaderText="Note Description" DataField="Description" />
                                                                                <asp:BoundField HeaderText="Note Type" DataField="Type" />
                                                                                <asp:BoundField HeaderText="Created By" DataField="CreatedBy" />
                                                                                <asp:BoundField DataFormatString="{0:MM/dd/yyyy}" HeaderText="Created Date" DataField="CreationDate" />
                                                                            </Columns>
                                                                        </asp:GridView>
                                                                    </div>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </telerik:RadPageView>
                                                </telerik:RadMultiPage>
                                            </td>
                                        </tr>
                                    </table>
                                </FormTemplate>
                            </EditFormSettings>


.cs file

protected void imgbtnNotesUpdate_Click(object sender, EventArgs e)
{
    try
    {
        clsTaskUpdates_BL objBL = new clsTaskUpdates_BL();
        //string strName = HttpContext.Current.User.Identity.Name.ToString();
        //if (strName.Length > 0)
        //    strName = strName.Substring(strName.IndexOf("\\") + 1);
        string strName = Session["UserName"].ToString();
         
        gvNotes.DataSource = objBL.updateNotes_Bl(Session["selNoteID"].ToString(), Session["selorderID"].ToString(), strName, ddlNoteType.SelectedItem.Text, txtNoteDesc.Text.Trim(), DateTime.Now.ToString());
        gvNotes.DataBind();
        ddlNoteType.ClearSelection();
        txtNoteDesc.Text = string.Empty;
        imgbtnNotesCancel.Visible = false;
        imgbtnNotesUpdate.Visible = false;
        btnAddNote.Visible = true;
    }
    catch (Exception ex)
    {
    }
 
}
 
protected void imgbtnNotesCancel_Click(object sender, EventArgs e)
{
    ddlNoteType.ClearSelection();
    txtNoteDesc.Text = string.Empty;
    imgbtnNotesCancel.Visible = false;
    imgbtnNotesUpdate.Visible = false;
    btnAddNote.Visible = true;
}
 
protected void gvNotes_SelectedIndexChanged(object sender, EventArgs e)
{
    try
    {
        Label lblID = (Label)gvNotes.SelectedRow.Cells[0].FindControl("lblonID");
        Session["selNoteID"] = lblID.Text;
        ddlNoteType.ClearSelection();
        for (int index = 0; index < ddlNoteType.Items.Count; index++)
        {
            if (ddlNoteType.Items[index].Text.ToLower() == gvNotes.SelectedRow.Cells[2].Text.ToLower())
                ddlNoteType.Items[index].Selected = true;
        }
        txtNoteDesc.Text = gvNotes.SelectedRow.Cells[1].Text.Trim().Replace(" ", "");
 
        imgbtnNotesCancel.Visible = true;
        imgbtnNotesUpdate.Visible = true;
        btnAddNote.Visible = false;
 
    }
    catch (Exception ex)
    {
    }
}

Thanks
Raj

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 21 Jul 2010, 01:15 PM
Hi Raj,

Please check this forum post.


Greetings,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
TabStrip
Asked by
Raj
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or