1
Answer

Error - Input string not in correct format

Sunny Singh

Sunny Singh

12y
2.3k
1


public static DataSet getProjectNoteDetail(int projNote_Id)
        {
            SqlParameter[] param = new SqlParameter[1];
            param[0] = new SqlParameter("@projNote_Id", projNote_Id);
            //return SqlHelper.ExecuteDataset(strConn, CommandType.StoredProcedure, "getProjectNoteDetailById", param);
            return SqlHelper.ExecuteDataset(strConn, CommandType.Text, "select * from tbl_projnotes where projnote_Id = @projNote_Id", param);
        }


Aspx

<asp:Repeater ID="repProjects" runat="server" OnItemCommand="repProjects_ItemCommand">
                                <ItemTemplate>
                                    <tr id="<%#(Convert.ToInt32(((RepeaterItem)Container).ItemIndex+1)%2==0?"ContentMainRow":"ContentAlternateRow")%>">
                                        <td>
                                            <%#(((RepeaterItem)Container).ItemIndex+1).ToString()%>
                                        </td>
                                        <td>
                                            <%#Eval("projNote_Title") %>
                                        </td>
                                        <td>
                                            <%#Eval("projNote_Note") %>
                                        </td>
                                        <td>
                                            <%#Eval("projNote_FileAttached") %>
                                        </td>
                                        <td>
                                            <asp:ImageButton ID="imgBtnEdit" CommandName="Edit" ToolTip="Edit a record." CommandArgument='<%#Eval("projNote_Id") %>'
                                                runat="server" ImageUrl="~/resources/Images/edit.png" />
                                            <asp:ImageButton ToolTip="View Details." ID="imgBtnViewProjectDetails" CommandName="View"
                                                CommandArgument='<%#Eval("projNote_Id") %>' runat="server" ImageUrl="~/resources/Images/viewDetails_Icon.png" />
                                        </td>
                                    </tr>
                                </ItemTemplate>
                            </asp:Repeater>
<asp:Repeater ID="repProjectDetails" runat="server">
                                        <ItemTemplate>
                                            <table border="1" style="border: 1px solid #4a6491; border-collapse: collapse;" cellpadding="5px"
                                                cellspacing="0" width="100%">
                                                <tr>
                                                    <td style="width: 25%;">
                                                        <b>Project Title</b>
                                                    </td>
                                                    <td style="width: 75%;">
                                                        <%#Eval("projNote_title")%>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td valign="top">
                                                        <b>Project Note</b>
                                                    </td>
                                                    <td>
                                                        <%#Eval("projNote_Note")%>
                                                    </td>
                                                </tr>
                                            </table>
                                        </ItemTemplate>
                                    </asp:Repeater>


aspx.cs
protected void repProjects_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        lblInfoMessage.Text = string.Empty;
        divMessage.Style.Add("display", "none");
        if (e.CommandName == "Edit")
        {
            hfCurrentTab.Value = (0).ToString();//======= To show the add tabcontainer on postback
            hfSelectedRecord.Value = e.CommandArgument.ToString();

            bindProjectRecordsToEdit(Convert.ToInt32(e.CommandArgument));
            tabContainerProjects.ActiveTabIndex = 0;
            btnSaveProject.Visible = false;
            btnUpdateProject.Visible = true;
        }
        else if (e.CommandName == "View")//====== To show the complete details of the project.
        {
            repProjectDetails.DataSource = clsManageNoteMethods.getProjectNoteDetail(Convert.ToInt32(e.CommandArgument));
            repProjectDetails.DataBind();
            mpeProjectDetails.Show();
        }
    }

When i click on View it gives error -- Input string was not in a correct format.

Thanx


Answers (1)