Hello,
I am using a datalist which is populated using database, is it possible to redirect to different pages if i click on particular link in datalist,i.e I am having 3 different services which i made as links, and populated from database, if i click on any link button it is redirecting to a single page,but i want it to redirect to their corresponding page.
My database table
CREATE TABLE MEDICALVOYAGER_BUSINESSUPLOAD_SERVICES
(BUSINESSUPLOAD_SERVICES_SERVICEID INT IDENTITY(1,1),
BUSINESSUPLOAD_SERVICES_SERVICENAME VARCHAR(100)PRIMARY KEY)
Here is my aspx page,
<body>
<form id="form1" runat="server">
<div>
<asp:DataList ID="datalist1" runat="server" OnItemCommand="abc">
<ItemTemplate>
<asp:LinkButton ID="link1" runat="server" CommandName="link1" >
<asp:Label ID="lbl1" runat="server" Text='<%#Eval("BUSINESSUPLOAD_SERVICES_SERVICENAME") %>' ></asp:Label>
</asp:LinkButton>
</ItemTemplate>
</asp:DataList>
</div>
</form>
</body>
My CS page
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=USER-PC\\SQLEXPRESS;Initial Catalog=MEDICALVOYAGER;Integrated Security=True");
con.Open();
SqlDataAdapter da = new SqlDataAdapter("select BUSINESSUPLOAD_SERVICES_SERVICENAME from MEDICALVOYAGER_BUSINESSUPLOAD_SERVICES", con);
DataSet ds = new DataSet();
da.Fill(ds, "voy");
datalist1.DataSource = ds;
datalist1.DataBind();
con.Close();
}
protected void abc (object source, DataListCommandEventArgs e)
{
if (e.CommandName == "link1");
{
Response.Redirect("services.aspx");
}
}
Please help me asap...