"../Radiology/EMR.aspx?&dReqId=" + Session[SessionVariable.ot_Req_no].ToString() + "&dVmId=" + Session[HMISWEB.SessionVariable.vmid].ToString() + "&strVisitType=" + Session[SessionVariable.OT_Visit_Type].ToString() + "&strModify_YN=N" + "&strDeptTemplateType=S" + "&dDocId=0" + "&strAccessString=Y";
I am consistently trying to share information through blog. This blog is may be helpful for beginners to asp.net.
Monday, 14 October 2013
Serial Number For grid view
<telerik:GridTemplateColumn UniqueName="SRNO" AllowFiltering="false" HeaderText="Sr No">
<ItemTemplate>
<asp:Label ID="lblSRNO" runat="server" ></asp:Label>
</ItemTemplate>
<HeaderStyle Width="5%" />
<ItemStyle Width="5%" />
</telerik:GridTemplateColumn>
protected void rdgAddedItems_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
Label lbl = e.Item.FindControl("lblSRNO") as Label;
lbl.Text = (e.Item.ItemIndex + 1).ToString();
}
}
<ItemTemplate>
<asp:Label ID="lblSRNO" runat="server" ></asp:Label>
</ItemTemplate>
<HeaderStyle Width="5%" />
<ItemStyle Width="5%" />
</telerik:GridTemplateColumn>
protected void rdgAddedItems_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
Label lbl = e.Item.FindControl("lblSRNO") as Label;
lbl.Text = (e.Item.ItemIndex + 1).ToString();
}
}
Wednesday, 19 June 2013
display image in image control from file upload control
string path = Server.MapPath("Images/") + FileUpload1.PostedFile.FileName;
FileUpload1.SaveAs(path);
Image3.ImageUrl = "Images/" + FileUpload1.PostedFile.FileName;
FileUpload1.SaveAs(path);
Image3.ImageUrl = "Images/" + FileUpload1.PostedFile.FileName;
Tuesday, 12 March 2013
how to access controls on another form c#
Form1 with 1 textbox and button
this button is for opening new form (form2)
Form2 with datagridview and button is for sending datagraidview value to textbox on Form1
On Form1
private void button_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2(this);
f2.Show();
}
On Form2
public Form2()
{
InitializeComponent();
}
private Form1 f1 = null;
public Form2(Form callingForm)
{
f1 = callingForm as Form1;
InitializeComponent();
}
private void button_Click(object sender, EventArgs e)
{
this.f1.TextBox = dataGridView1.SelectedRows[0].Cells["columnname"].Value.ToString();
this.Close();
}
this button is for opening new form (form2)
Form2 with datagridview and button is for sending datagraidview value to textbox on Form1
On Form1
private void button_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2(this);
f2.Show();
}
On Form2
public Form2()
{
InitializeComponent();
}
private Form1 f1 = null;
public Form2(Form callingForm)
{
f1 = callingForm as Form1;
InitializeComponent();
}
private void button_Click(object sender, EventArgs e)
{
this.f1.TextBox = dataGridView1.SelectedRows[0].Cells["columnname"].Value.ToString();
this.Close();
}
Wednesday, 27 February 2013
how to clear all textbox in asp.net
protected void Button1_Click(object sender, EventArgs e)
{
ClearInputs(Page.Controls);
}
void ClearInputs(ControlCollection ctrls)
{
foreach (Control ctrl in ctrls)
{
if (ctrl is TextBox)
((TextBox)ctrl).Text = string.Empty;
ClearInputs(ctrl.Controls);
}
}
{
ClearInputs(Page.Controls);
}
void ClearInputs(ControlCollection ctrls)
{
foreach (Control ctrl in ctrls)
{
if (ctrl is TextBox)
((TextBox)ctrl).Text = string.Empty;
ClearInputs(ctrl.Controls);
}
}
Monday, 18 February 2013
check if record already exists access
SqlConnection con = new SqlConnection(strConnString);
SqlCommand
cmdCount = new SqlCommand("select count(*) from customers where name='"
+ txtCustomername.Text + "'",
con);
con.Open();
int
count = (int)cmdCount.ExecuteScalar();
if
(count > 0)
{
lblMessage.Text = "Customer already exists";
lblMessage.Visible = true;
}
else
{
Insert
query
}
con.Close();
Saturday, 16 February 2013
bind dropdownlist in asp.net using dataset
protected void BindCustomerNameddl()
{
con.Open();
SqlCommand cmd = new SqlCommand("Select cid,name FROM memberLogin", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
ddlCustomername.DataSource = ds;
ddlCustomername.DataTextField = "name";
ddlCustomername.DataValueField = "cid";
ddlCustomername.DataBind();
ddlCustomername.Items.Insert(0, new ListItem("--Select--", "0"));
con.Close();
}
{
con.Open();
SqlCommand cmd = new SqlCommand("Select cid,name FROM memberLogin", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
ddlCustomername.DataSource = ds;
ddlCustomername.DataTextField = "name";
ddlCustomername.DataValueField = "cid";
ddlCustomername.DataBind();
ddlCustomername.Items.Insert(0, new ListItem("--Select--", "0"));
con.Close();
}
Subscribe to:
Posts (Atom)