Quantcast
Channel: Programmers Heaven Forums RSS Feed
Viewing all articles
Browse latest Browse all 2703

Unable to change label text for certain location on web form (Label.te

$
0
0
Hi,

I am trying to change label text on button click, the way label.text = "string" work well before but not in this case.
I tried to put this on other method and it work..it is just not working on the button that I would like to fire..

Can anybody help?? I stuck in this problem for fews day..and cant get any useful information from google..

C# code :
protected void btnTotalGroupMember_Click(object sender, EventArgs e)
{
string s = "there";
string[] words = s.Split(' ');
foreach (string word in words)
{
Label1.Text = s;
}

SqlConnection con;
String conStr = ConfigurationManager.ConnectionStrings["Connection
String"].ConnectionString;
con = new SqlConnection(conStr);

con.Open();

string selectMemberQuery = "SELECT userID from [group]";
SqlCommand cmd = new SqlCommand(selectMemberQuery, con);
SqlDataReader rd = cmd.ExecuteReader();

if (rd.HasRows)
{
rd.Read();

string UID = rd["userID"].ToString();
string[] cUIDs = UID.Split(',');
foreach (string cUID in cUIDs)
{
string sqlQuery2 = "SELECT m.username,m.email from member m,group g where m.userID = " + cUID;
SqlCommand cmd2 = new SqlCommand(sqlQuery2, con);
SqlDataReader rd2 = cmd2.ExecuteReader();

/* if (rd2.HasRows)
{
rd2.Read();


Table tbl = new Table();
tbl.ID = "tblUser";

this.Controls.Add(tbl);

TableRow rw = new TableRow();

TableCell cell = new TableCell();
TableCell cell2 = new TableCell();

Label text = new Label();
Label text2 = new Label();

Label1.Text = rd2["username"].ToString();
Label2.Text = rd2["email"].ToString();

cell.Controls.Add(text);
cell2.Controls.Add(text2);

rw.Cells.Add(cell);
rw.Cells.Add(cell2);

tbl.Controls.Add(rw);
}*/
}

}

con.Close();

}


Web Form ( button)

<asp:Button ID="btnTotalGroupMember" runat="server" 
BorderStyle="None" Font-Size="12px" ForeColor="#A29881" BackColor="White" 
OnClientClick="return addEventInterface2();" 
onclick="btnTotalGroupMember_Click"/>


Web Form (addEventInterface2) -> Java script function

function addEventInterface2() {
document.getElementById('overlayLayer2').style.pad
dingTop = "50%";
document.getElementById('overlayLayer2').style.vis
ibility = "visible";
document.getElementById('overlayLayer2').className = "ui-widget-overlay";
document.getElementById('shadow2').className = "ui-widget-shadow ui-corner-all";
document.getElementById('shadow2').style.visibilit
y = "visible";
document.getElementById('hi3').className = "ui-widget ui-widget-content ui-corner-all";
document.getElementById('hi3').style.visibility = "visible";
document.getElementById('addEventIntContent2').cla
ssName = "ui-dialog-content ui-widget-content";
document.getElementById('addEventIntContent2').sty
le.visibility = "visible";
document.getElementById('draggableInt2').style.vis
ibility = "visible";
return false;
}


Web form ( the location of label text that I would like to change)

<div id="overlayLayer2" style="height: 1%; visibility: hidden;"> </div><div id="draggableInt2" style="width: 50%; height: 65%; position: absolute; left: 32%; top: 20%;
visibility: hidden;"><div id="shadow2" style="width: 100%; height: 100%; position: absolute; left: 0.5%;
top: 0.5%; visibility: hidden;"></div><div id="hi3" style="position: absolute; width: 97%; height: 97%; left: 1.5%; top: 1.5%;
visibility: hidden;"><div id="addEventIntContent2" style="background: none; border: 0; visibility: hidden;"><br /><div style="float: right"><asp:ImageButton ID="btnCloseEventInt2" runat="server" ImageUrl="~/image/btnCloseEventInt.png"
OnClientClick="return endEventInterface2()" /></div><div><asp:Label ID="Label1" runat="server" ></asp:Label><asp:Label ID="Label2" runat="server" ></asp:Label></div> </div></div></div>


Viewing all articles
Browse latest Browse all 2703

Trending Articles