PDA

View Full Version : سوال: مشکل با انتخاب کردن یه ستون از gridview



ali9698
دوشنبه 29 آبان 1391, 12:10 عصر
سلام به همگی
یه gridview دارم که میخوام روی هر جایی از هر سطر که کلیک شد اون سطر انتخاب بشه
یعنی نمیخوام از select خود grid view استفاده کنم.
------------
auto generate select button=false

ali9698
دوشنبه 29 آبان 1391, 13:48 عصر
جوابی نیست؟!!

arefba
دوشنبه 29 آبان 1391, 15:12 عصر
از گرید telerik استفاده کن

fakhravari
دوشنبه 29 آبان 1391, 16:30 عصر
ساده ^ 10

public void ChekRateID(bool st, int PostID)
{
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationMa nager.ConnectionStrings["DatabaseConnectionString1"].ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "UPDATE Table1 SET active =@active where id=@id";
cmd.Parameters.Add("@active", SqlDbType.Bit).Value = st;
cmd.Parameters.Add("@id", SqlDbType.Int).Value = PostID;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}

protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "ediit")
{
GridViewRow row = (GridViewRow)((Button)e.CommandSource).NamingConta iner;

CheckBox ch = (CheckBox)row.FindControl("CheckBox1");
ChekRateID(ch.Checked, int.Parse(e.CommandArgument.ToString()));

}


}
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="id"
DataSourceID="SqlDataSource1" EmptyDataText="There are no data records to display."
OnRowCommand="GridView1_RowCommand">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("lastnaame")%>'></asp:Label>
<br />
<asp:Label ID="Label2" runat="server" Text='<%# Eval("firstname")%>'></asp:Label>
<br />
<asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Eval("active") %>' />
&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button1" runat="server" Text="ویرایش" CommandName="ediit" CommandArgument='<%# Eval("id") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

ali9698
دوشنبه 29 آبان 1391, 23:05 عصر
آقای arefba از کجا دانلود کنم؟!

arefba
چهارشنبه 01 آذر 1391, 05:47 صبح
من خودم از آقای کرامتی گرفتمش
سرچ کنید پیداش می کنید خیلی امکانات خوبی داره