Имам поле за търсене, което взема потребителско име и търси по него в потребителския списък, проблемът е, че искам от програмата да търси директно, тъй като той получава първата буква от потребителя
Преден край
<asp:TextBox ID="TextBox1"
class="form-control table-search-input"
ontextchanged="TextBox1_TextChanged"
AutoPostBack="True"
runat="server" >
Бекенд
protected void TextBox1_TextChanged(object sender, EventArgs e )
{
int bb=TextBox1.Text.Length;
adminuserlist2 = adminuserlist2.Where(o => o.AdminUserName.Substring(0,bb) == TextBox1.Text).ToList();
if (adminuserlist2 != null)
{
Table1.Rows.Clear();
Table1.BorderWidth = 1;
Table1.BorderStyle = BorderStyle.Groove;
Table1.GridLines = GridLines.Both;
TableCell un = new TableCell();
un.Text = "UserName";
TableCell pass = new TableCell();
pass.Text = "Password";
TableCell email = new TableCell();
email.Text = "Email";
TableCell isactives = new TableCell();
isactives.Text = "IsActive";
TableCell typename = new TableCell();
typename.Text = "Type Name";
TableCell typeid = new TableCell();
typeid.Text = "Type Id";
row = new TableRow();
row.Width = new Unit("120%");
row.BackColor = System.Drawing.Color.White;
row.ControlStyle.Font.Size = 25;
row.ControlStyle.Font.Bold = true;
row.ControlStyle.ForeColor = System.Drawing.Color.Black;
row.Controls.Add(un);
row.Controls.Add(pass);
row.Controls.Add(email);
row.Controls.Add(isactives);
row.Controls.Add(typename);
row.Controls.Add(typeid);
Table1.Controls.Add(row);
row.ControlStyle.Width = 300;
row.ControlStyle.Height = 30;
Table1.Width = 500;
Table1.ControlStyle.Width = 1000;
Table1.Height = 500;
Table1.CellSpacing = 50;
Table1.CellPadding = 50;
for (int i = 0; i < adminuserlist2.Count; i++)
{
TableCell un2 = new TableCell();
un2.Text = adminuserlist2[i].AdminUserName;
TableCell pass2 = new TableCell();
pass2.Text = adminuserlist2[i].AdminUserPassword;
TableCell email2 = new TableCell();
email2.Text = adminuserlist2[i].AdminUserEmail;
TableCell isactives2 = new TableCell();
isactives2.Text = adminuserlist2[i].IsActive.ToString();
TableCell typename2 = new TableCell();
typename2.Text = adminuserlist2[i].AdminUserType;
TableCell typeid2 = new TableCell();
typeid2.Text = adminuserlist2[i].AdminUserTypeID.ToString();
row = new TableRow();
row.Controls.Add(un2);
row.Controls.Add(pass2);
row.Controls.Add(email2);
row.Controls.Add(isactives2);
row.Controls.Add(typename2);
row.Controls.Add(typeid2);
Table1.Controls.Add(row);
}
}
}
Сблъсках се с проблем, че трябва да щракна извън текстовото поле, за да търся, моля, всеки може да помогне