dialog box in web application???

Posted by Oswaldlily under ASP.NET on 7/10/2012 | Points: 10 | Views : 1862 | Status : [Member] | Replies : 4
In button click event in window application-vb.net,they have used this code so that dialog box ll open contain specific columns
Dim _search As New Search("Select P.PartNo 'Part No',P.Part_Name as 'Part Name',P.Div_Code as 'Code' from Table1 P, Table2 D WHERE P.Del_Flag=N'A', "Details")
_search.ShowDialog()

How to do this in web application-C#.net?
Any format to open dialog box when clicks button???




Responses

Posted by: Premalatha on: 7/10/2012 [Member] Starter | Points: 25

Up
0
Down
I am giving 1 Ex. When i delete a record, it will ask, Are You Sure to Delete if?

<asp:GridView ID="GridView1" AllowPaging="true" AutoGenerateColumns="false"
runat="server" ShowFooter="true" HeaderStyle-BackColor="Red"
OnRowEditing="EditStudent" OnPageIndexChanging="OnPaging"
OnRowUpdating="StudUpdate" OnRowCancelingEdit="CancelEdit" PageSize="10" >

<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="LnkBtn" runat="server" CommandArgument='<%# Eval("StudentId")%>' OnClientClick="return confirm('Do you Want to Delete it?')" Text="Delete" OnClick="DeleteStudent"></asp:LinkButton>

</ItemTemplate>
<FooterTemplate><asp:Button ID="AddBt" runat="server" Text="AddNewStudent" OnClick="AddNewStudent" /></FooterTemplate>
</asp:TemplateField>

protected void DeleteStudent(object sender, EventArgs args)
{
LinkButton LnkRemove = (LinkButton)sender;
SqlConnection con = new SqlConnection(conStr);
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
con.Open();
cmd.CommandText = "Delete from Student where StudentId=@p1;" + "select StudentId,FirstName,LastName,Address,StudMail,StudPhone,Gender from Student";
cmd.Parameters.Add("@p1", SqlDbType.NChar).Value = LnkRemove.CommandArgument;
cmd.Connection = con;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds,"Student");
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();
BindData();

}
protected void OnPaging(object sender, GridViewPageEventArgs e)
{
BindData();
GridView1.PageIndex = e.NewPageIndex;
GridView1.DataBind();
}


Premalatha
Software Engineer

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sumit.Bundiwal on: 7/10/2012 [Member] Starter | Points: 25

Up
0
Down
you can use alert function of javascript to show dialogue box

sumit bundiwal

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Aksrinivas84 on: 7/11/2012 [Member] Starter | Points: 25

Up
0
Down
As said by sumit you can use scripting language techniques to display the alert box
on a particular event

If you dont want to implement scripting then you need to write your own custom class in
order to implement that functionality

If you want you can post your reply to me so that i can post the custom class for you

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bhupentiwari on: 7/11/2012 [Member] Starter | Points: 25

Up
0
Down
You can use this code

  ClientScript.RegisterClientScriptBlock(typeof(Page), "test", "<script language='javascript'>alert('Your message'); </script>");


Thanks n Regards
Bhupendra Tiwari

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response