DataNavigateUrlFormatString="UpdatePage.aspx?ECODE={0}&ENAME={1}&;DESIGNATION={2}&;LOCATION={3}"
Text="clickToUpdatePage" />
code-behind page:-
public partial class EmpFetch : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//if (!IsPostBack)
}
protected void submit_Click(object sender, EventArgs e)
{
Library lib = new Library();
string sEmp_name = empname.Text;
DataTable dtEmpDetail = new DataTable();
dtEmpDetail = lib.GetEmpInfo(sEmp_name);
if (dtEmpDetail.Rows.Count > 0)
{
grdJobHistory.DataSource = dtEmpDetail;
grdJobHistory.DataBind();
}
}
protected void grdJobHistory_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
Library lib = new Library();
string sEmp_name = empname.Text;
DataTable dtEmpDetail = new DataTable();
dtEmpDetail = lib.GetEmpInfo(sEmp_name);
if (dtEmpDetail.Rows.Count > 0)
{
grdJobHistory.PageIndex = e.NewPageIndex;
grdJobHistory.DataSource = dtEmpDetail;
grdJobHistory.DataBind();
}
}
}
3 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
CrishPosted May 14, 2010, 6:59 AM
use below code for your issue.
thanks
Satyapriya NayakPosted May 14, 2010, 12:38 AM
The complete program is below of your requirements.
Default.aspx.vb:-
Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Dim strConnString As String = System.Configuration.ConfigurationManager.ConnectionStrings.Item("ConnectionString").ToString()
Dim con As New SqlConnection(strConnString)
Dim str As String
Dim com As SqlCommand
Dim sqlda As SqlDataAdapter
Dim ds As DataSet
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
bind()
End Sub
Sub bind()
con.Open()
str = "select * from employee"
com = New SqlCommand(str, con)
Dim reader As SqlDataReader
reader = com.ExecuteReader()
GridView1.DataSource = reader
GridView1.DataBind()
con.Close()
End Sub
End Class
Default.aspx design code:-
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
http://www.w3.org/1999/xhtml">
UpdatePage.aspx.vb code:-
Imports System.Data
Imports System.Data.SqlClient
Partial Class UpdatePage
Inherits System.Web.UI.Page
Dim strConnString As String = System.Configuration.ConfigurationManager.ConnectionStrings.Item("ConnectionString").ToString()
Dim con As New SqlConnection(strConnString)
Dim str As String
Dim com As SqlCommand
Dim sqlda As SqlDataAdapter
Dim ds As DataSet
Dim s1 As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
con.Open()
s1 = Request.QueryString(0)
str = "select * from employee where Ecode='" + s1 + "'"
com = New SqlCommand(str, con)
Dim reader As SqlDataReader
reader = com.ExecuteReader
If reader.Read Then
Label1.Text = reader("Ecode")
Label2.Text = reader("EmployeeName")
Label3.Text = reader("Designation")
Label4.Text = reader("Location")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class
UpdatePage.axpx design code:-
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="UpdatePage.aspx.vb" Inherits="UpdatePage" %>
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
http://www.w3.org/1999/xhtml">
Thanks
Plz run the attachments.............
If it helps you plz mark it (click the checkbox as Accepted Answer)
sanjay dobhalPosted May 14, 2010, 12:02 AM
You can make this problem like this...
Make a javascript function :
function popup(url)
{
mywin=window.open(url,"","status=no,width=950,height=900,scrollbars=yes, resizable= no, left=150,top=90");
mywin.focus();
}
Define in Template field like this .
<ItemTemplate>
<a href="javascript:popup1(targetpage.aspx?ItemID=<%# Eval("ItemID")%>')">
<asp:Label ID="lbView" Text="View" runat="server">asp:Label> a>
ItemTemplate>
Now you can redirect your page to new window popup or new full windows in this way.
If this is usefulll for you please reply ..
Sanjay Dobhal