1

我已经自定义了网格控件,当我们提供列和表名时生成表,其中还有一个搜索功能,它更新记录并在通过 ajax 搜索时在网格中显示更新的结果我正在更新记录但未显示在主页中

        SqlParameter[] sqlParameter = {new SqlParameter("@table",tabelName),
                                      new SqlParameter("@Column1",coloumn1),
                                      new SqlParameter ("@Column2",coloumn2),
                                      new SqlParameter("@AliasName1",aliasName1),
                                      new SqlParameter("@AliasName2",aliasName2)

                                      };

        string gridHtml;
        if (!isFilterCondition)
        {
             gridHtml = GenerateHtmlGrid(sqlParameter);
        }
        else
        {
            gridHtml = GenerateHtmlGridonSearch();
        }
        StringBuilder sb = new StringBuilder();
        //Opening For Main page Search Control
        sb.AppendFormat("<table>");
        sb.AppendFormat("<tr><td>");
        sb.AppendFormat("<input id='txt_Search' type='text'  name='txt_Search'>");
        sb.AppendFormat("<input type='hidden' name='{0}' class='WorkItem'>", controlName);
        sb.AppendFormat("</td><td>");
        sb.AppendFormat("<a href='#' id='searchlink'><img src='../../Content/themes/base/images/16px-Searchtool_right.png' /></a>");
        sb.AppendFormat("</td></tr></table>");
        //Closing For Main page Search Control

        // Opening for the Dialog Box Div
        sb.AppendFormat("<div id='dialoggrid' title='{0}' >", popWindowTitle);
        sb.AppendFormat("<table>");
        sb.AppendFormat("<tr><td></td><td>");
        sb.AppendFormat("<select name='foo' id='foo'>");
        sb.AppendFormat("<option value=0>{0}</option>", aliasName1);
        sb.AppendFormat("<option value=1>{0}</option>", aliasName2);
        sb.AppendFormat("</select>");
        sb.AppendFormat("</td></tr>");
        sb.AppendFormat("<tr><td>");
        sb.AppendFormat("<label>Search</label>");
        sb.AppendFormat("</td><td>");
        sb.AppendFormat("<input id='txtGridSearch' type='text'  name='txtGridSearch'>");
        //sb.AppendFormat("<a href='#' id='SearchTree'><img src='../../Content/themes/base/images/16px-Searchtool_right.png' /></a>");
        sb.AppendFormat("</table>");

        sb.AppendFormat("<div id='div_grid'>{0}</div>", gridHtml);
        sb.AppendFormat("</div>");
        // Closing  for the Dialog Box Div

        //opening For Script Section 
        sb.AppendFormat("<script type='text/javascript'>");

        //Opening for Document Reddy
        sb.AppendFormat("$(document).ready(function() {{ ");
        sb.AppendFormat("$('#dialoggrid').dialog({{ autoOpen: false,modal: true,width: 350}});");
        //Function For SearchButton on Main Page Click 
        sb.AppendFormat("$('#searchlink').click(function() {{");
        sb.AppendFormat("$( '#dialoggrid').dialog('open');");
        sb.AppendFormat("}});");
        //Closing For SearchButton on Main Page Click 

        //opening For Textbox Search inside the Grid on Key Up Event
        sb.AppendFormat("$('#txtGridSearch').keyup(function(){{");
        sb.AppendFormat("$.post('/CustomeControls/GridSearch')");


        sb.AppendFormat("}});");
        //Closeing For Textbox Search inside the Grid on Key Up Event

        sb.AppendFormat("}});");
        //Closing For Document Reddy Function 

        sb.AppendFormat("</script>");
        //Closing for Script Section 


        return new MvcHtmlString(sb.ToString());
    }
4

0 回答 0