sudhanvag
Posts
-
Datagrid -
How to create an array of buttons then access attributes in event handlerscjsb wrote:
The problem is the event handler never triggers.
Check this out.
public partial class Default3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ButtonArray();
}protected void ButtonArray() { try { for (int i = 0; i < 14; i++) { Button new\_button = new Button(); new\_button.ID = "btn" + Convert.ToString(i); new\_button.Text = "Button" + Convert.ToString(i); //new\_button.Click += new EventHandler(btn\_Click); new\_button.Click += new EventHandler(new\_button\_Click); panelLineA.Controls.Add(new\_button); } } catch (Exception ex) { lblStatus.Text += ex.Message.ToString(); } } void new\_button\_Click(object sender, EventArgs e) { int btnIndex = Convert.ToInt32(((Button)sender).ID.Substring(3, 1)); lblStatus.Text = "Button " + btnIndex + " was pushed." + ((Button)sender).ID; }
}
Cheers, Sudhanva
-
dropdown listYou can use Ajax. Use AjaxControlToolKit[^], where in you can place server side controls in
UpdatePanel
, and write serverside code. Thus you can avoid postbacks. I hope this helps you. Cheers, Sudhanva -
Binding html tags to a gridMy application has a online test module, where i generate controls at runtime. As shown in the code block below. I am inserting them in a datatable (one span tag in one row) I want to bind it to a control (say gridview) and provide paging. How can i do this? If i bind the datatable to the gridview i am able to see the html tags only but not the controls. I am :confused:
<span id="lblQuestion01" class="optQuizup"><br>1) CHSC Question1 (Marks 2)<br><br></span>
<span class="optQuizup"><input id="chkOption00" type="checkbox" name="chkOption00" onclick="uncheckOthers(chkOption00,0,4);" /><label for="chkOption00">vxcv<br></label></span>
<span class="optQuizup"><input id="chkOption01" type="checkbox" name="chkOption01" onclick="uncheckOthers(chkOption01,0,4);" /><label for="chkOption01">cxvcb<br></label></span>
<span class="optQuizup"><input id="chkOption02" type="checkbox" name="chkOption02" onclick="uncheckOthers(chkOption02,0,4);" /><label for="chkOption02">ghfgh<br></label></span>
<span class="optQuizup"><input id="chkOption03" type="checkbox" name="chkOption03" onclick="uncheckOthers(chkOption03,0,4);" /><label for="chkOption03">fbvcb<br></label></span>
<span id="lblQuestion11" class="optQuizup"><br>2) CHSC Question2 (Marks 2)<br><br></span>
<span class="optQuizup"><input id="chkOption10" type="checkbox" name="chkOption10" onclick="uncheckOthers(chkOption10,1,4);" /><label for="chkOption10">asdkf<br></label></span>
<span class="optQuizup"><input id="chkOption11" type="checkbox" name="chkOption11" onclick="uncheckOthers(chkOption11,1,4);" /><label for="chkOption11">ugodf<br></label></span>
<span class="optQuizup"><input id="chkOption12" type="checkbox" name="chkOption12" onclick="uncheckOthers(chkOption12,1,4);" /><label for="chkOption12">dfgkls<br></label></span>
<span class="optQuizup"><input id="chkOption13" type="checkbox" name="chkOption13" onclick="uncheckOthers(chkOption13,1,4);" /><label for="chkOption13">kldfjls<br></label></span>Thanks
-
COLUMN WISE DISPLAYING TWO QUERIE VALUE FROM DATASET TO GRIDVIEWDataTable dt1 = new DataTable("student"); dt1.Columns.Add("Name", typeof(string)); dt1.Rows.Add("a"); dt1.Rows.Add("b"); dt1.Rows.Add("c"); DataTable dt2 = new DataTable("employee"); dt2.Columns.Add("Name", typeof(string)); dt2.Rows.Add("x"); dt2.Rows.Add("y"); dt2.Rows.Add("z"); DataTable dt3 = new DataTable("student\_employee"); dt3.Columns.Add("StudentName", typeof(string)); dt3.Columns.Add("EmployeeName", typeof(string)); //further you can add an IF condition to check the max dt.row.count here for (int i = 0; i < dt1.Rows.Count; i++ ) { for (int j = 0; j < dt2.Rows.Count; j++) { dt3.Rows.Add(dt1.Rows\[i\]\["Name"\].ToString(), dt2.Rows\[i\]\["Name"\].ToString()); break; } } //bind the dt3 with gridview here
Cheers, Sudhanva
-
Multiple values in a querystringferronrsmith wrote:
I wanna create a form that grabs data from a database and insert it in my layout
Instead create a usercontrol (which should have your forms' controls) to bind the data, and put a
for
loop for number of querystring items, and call the usercontrol and bind the data. That should solve your problem. Cheers, Sudhanva -
Multiple values in a querystringferronrsmith wrote:
So basically, if the user enters only one value, only 1 report is queried if they entered more than 1 then more than one report is generated one after another.
What do you mean report here?? Is it a crystal report? I dont see any report binding code. I would appreciate if you elaborate your requirement. Cheers, Sudhanva
-
Change user controls in runtime using c#You can do it using delegates. Create a delegate in the usercontrol with some return type / parameters with which you can set the visibility of the usercontrol, add an event for this delegate. Add a button with a button click event in user ctrl. Call the event in the webpage which in turn should call the user control's button click event. Try this out. Cheers, Sudhanva
-
COLUMN WISE DISPLAYING TWO QUERIE VALUE FROM DATASET TO GRIDVIEWHi karan, I dont know why you want to show it like that, but you can loop through two tables, i mean having two loops one inside the other (Note: Outer for loop should be for max row count table) and add the data in to a new table. Then bind the new table to the grid. I have not implemented this, but i am sure this should work. Try. Cheers, Sudhanva.
-
Object reference not set to an instance of an objectCheck the connection string. Enter valid credentials, and database name. Cheers, Sudhanva
-
Export data from gridview to pdf in c# -
scrollbar in panelHi Sam, I tried working on the sample and it is working fine. I meand the scroll bar is at the end (right end) of the panel. You can try with div tag instead of panel: <div style="overflow:auto; width:auto; height:250px; border-color:CornflowerBlue; border-width:medium; border-style:solid;"> Sudhanva.
modified on Thursday, January 8, 2009 12:12 AM