Author: Kiran Kumar Pinjala Member Level: Silver Member Rank: 0 Date: 14/Nov/2005 Rating:  Points: 2 |
Here is how you can use the link button.
<asp:HyperLinkColumn Target="_self" DataTextField="ProductName" SortExpression="ProductID" HeaderText="ProductID Link" NavigateUrl="http://www.dotnetspider.com"></asp:HyperLinkColumn>
Put this within the Columns tag of the <asp:datagrid> tags.
you can replace the NavigateUrl attribute with any url.
|
Author: mohd. asif Member Level: Silver Member Rank: 0 Date: 17/Nov/2005 Rating:  Points: 2 |
hi the solution of ur first question is given by Kiran os absolutely correct. the solution of second question is this
<asp:TemplateColumn SortExpression="empName" HeaderText="Employee Name"> <HeaderStyle Wrap="False" HorizontalAlign="Center"></HeaderStyle> <ItemStyle Font-Underline="True" Font-Bold="True" HorizontalAlign="Left" ForeColor="Blue"></ItemStyle> <ItemTemplate> <asp:hyperlink style="cursor:hand" Runat="server" ID="empName"> <%# Container.dataitem("empName")%> </asp:hyperlink> </ItemTemplate> <EditItemTemplate> <asp:DropDownList ID="Emp_Name" Runat=server AutoPostBack=False text='<%# container.dataitem("empName") %>'> </asp:DropDownList> </EditItemTemplate> </asp:TemplateColumn>
addthis column in ur html page. on the code page
on the datagrid1_ItemDataBound on event write this.
If e.Item.ItemType = ListItemType.EditItem Then Dim tblEmpName As New DataTable Dim tblSelectEmp As New DataTable Dim subtask_id As Integer = CInt(Datagrid1.DataKeys(e.Item.ItemIndex)) Dim empName, empDept As DropDownList empName = CType(e.Item.FindControl("emp_name"), DropDownList) con = New ClassLibrary.Returndbset con.Connect() tblEmpName = con.GetDataTable("Select upper(a.user_id) employee,a.employee_id from employee b join login_master a on a.employee_id=b.employee_id where b.emptypeid<>2", con.conMas) empName.DataSource = tblEmpName empName.DataTextField = "employee" empName.DataValueField = "employee_id" empName.DataBind() tblSelectEmp = con.GetDataTable("select e.employee_id eid,d.dept_id did from project_task p join employee e on e.employee_id=p.employee_id join dept_master d on e.employee_deptid=d.dept_id where p.subtask_id=" + Datagrid1.DataKeys(e.Item.ItemIndex).ToString, con.conMas) empName.SelectedValue = tblSelectEmp.Rows(0)("eid") con.Close() End If
and on the update event of datagrid find the dropdown list and use that.......
Hope it will work for ur.....
|