|
In the RowDataBound event, you can format an entire row like this:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if( < some boolean statement here > )
{
e.Row.BackColor = System.Drawing.Color.Blue;
}
}
}
|
|
|
|
|
wat u gave is right sir but i want this to in javascript becoz element.style.color i wrote in javascript
|
|
|
|
|
The GridView outputs a html table to the browser so if your javascript is changing the colour of one cell then you are accessing the <td> tag, you need to access the parent <tr> to style the entire row.
|
|
|
|
|
I would like to configure VS to use a remote IIS server for debugging a .NET 3.5 web application. How do I do this?
Everything I find on the web claims that I just have to set some properties in the project configuration under the debugging tab to point to the right server. However, there is no Debugging tab. Under the Web tab, I only seem to be able to specify a local IIS server, not a remote one.
I also found one guide that said VS will automatically publish/deploy my application before debugging. This would be very useful but I also do not have a Deployment tab which this guide referred to.
I assume these guides were for VS2005 or earlier? They did not specify. How can I accomplish what I want? Ideally, VS would also publish the application before opening it for debugging.
(Search keeps giving me the "No error" error, so my apologies if this is an often-asked question)
|
|
|
|
|
iam having a text box with multiline property now i want the second line is alway sto be hiligthed. how could be possible
|
|
|
|
|
As i think it is not possible in textbox , you can try with RichTextBox.
Because in textbox , it contain same property for all chartacter as NotePad,
|
|
|
|
|
Abhijit Jana wrote: Because in textbox , it contain same property for all chartacter as NotePad,
What do you mean ?
|
|
|
|
|
What ever font or color or font style you apply to a Notepad it will be same
for conatin of that file, you cant use multiple color to differ character in Notepad
and this is the concept of TextBox.
If you thing about wordpad , it has same features of RichTextBox, as you can apply multiple color
style for differt line etc...
Please Correct me if I am wrong !!!
Thanks
|
|
|
|
|
Abhijit Jana wrote: you cant use multiple color to differ character in Notepad
and this is the concept of TextBox.
Ohh you mean that. It was not giving clear idea, Yes you are correct, a normal textbox is used for showing/entering plain text.
|
|
|
|
|
Could any one please tell me how to insert multiple values into a single column i want structure something like this
JobNumber SupplyParts
J001 Tyres
Mirrors
Bonnets
Rear Bumper
J002 Side Bumper
Bonnet
Seat Cover
Please tell me how to insert values into the column JobNumber and SupplyParts with a single insert statement where column SupplyParts will have multiple rows and at the same time JobNumber value will be only One.
Currently iam inesrting values like this
string InsertName = "insert into ComplaintSupply" +
"(JobNum, SupplyParts)"
+ "values('" + this.txtSupplyParts1.Text + "'),('" + this.txtSupplyParts2.Text + "'),('" + this.txtSupplyParts3.Text + "'), ('" + this.txtSupplyParts4.Text + "'),('" + this.txtSupplyParts5.Text + "')";
MySqlCommand command = new MySqlCommand(InsertName, ComplaintSupply.con);
ComplaintSupply.dComplaintSupplyAdapter.InsertCommand = command;
//Insert New Record.
ComplaintSupply.dComplaintSupplyAdapter.InsertCommand.ExecuteNonQuery();
In the above code i am inserting multiple rows for SupplyParts column from different 5 textboxes but iam not getting how to insert value for JobNum column taking value from some other text box say txtJobNum.
Any help will be greatly appreciated. I am new with database and could not able to solve this issue from last 1 week
Thanks in Advance
Imran
|
|
|
|
|
Hi
Your problem is more SQL related than ASP.NET related. I'd post this in the SQL forum. Also, don't build up SQL strings by concatonation. You are wide open to SQL Injection Attacks[^]
Small angry dogs
|
|
|
|
|
By default I have 10 rows of dynamically created controls on Page Load. After entering Data, When i click Submit button, only rows in which data entered should be inserted into the database.
I am inserting records based on the table rows count. So, it inserts 10 records even if values are not entered.
protected void btnSubmit_Click(object sender, EventArgs e)
{
int j = tblRunTime.Rows.Count;
for (int c = 0; c < j; c++)
{
string query = " INSERT INTO Time VALUES( ";
query = query + " '" + Request.Form["_dr1" + c.ToString()] + "', ";
query = query + " '" + Request.Form["_dr2" + c.ToString()] + "', ";
query = query + " '" + Request.Form["text1" + c.ToString()] + "', ";
...
query = query + " '" + Request.Form["text8" + c.ToString()] + "', ";
query = query + " '" + f_date_b.Value + "'";
query = query + " )";
}
So, how i can solve this?
Can anyone please help me?
Thanks & Regards,
Radha
|
|
|
|
|
In this, you are not checking the value is entered or not. And your controls are dynamically created on page_load, which don't have a viewstate maintained. So you won't get values for those controls. Consider creating it in some other event like (Init). Also read about SQL Injection attacks.
|
|
|
|
|
But, I can get values for those controls. If i enter Data for 2 rows and click Submit button, 2 rows will be inserted with the entered values and the remaining 8 rows will be inserted with null values. I dont want that 8 rows to be inserted.
Thanks & Regards,
Radha
|
|
|
|
|
Before insertion, check the controls has a value. If not sip it,
|
|
|
|
|
But, I can get values for those controls. If i enter Data for 2 rows and click Submit button, 2 rows will be inserted with the entered values and the remaining 8 rows will be inserted with null values. I dont want that 8 rows to be inserted. How can i do this?
Thanks & Regards,
Radha
|
|
|
|
|
hi,
Can anyone tell me how to bind a DataTable Column field to a DropDownList Items which is present in a GridView.
DataTable and GridView is generated at runtime.
A key to every Solution
|
|
|
|
|
You need to find DropDown from GridView in GridView's RowDataBound event and bind it.
|
|
|
|
|
Thanks,
Can I add it like Eval on Bind method as we do for label..
<asp:templatefield headertext="CUST_ID">
<headertemplate>CUST_ID
<itemtemplate>
<asp:label id="lblCustID" text="">]]>' runat="server">
I have the DropDownList instead of Label and CUST_ID is the Column anme present in the DataTable
A key to every Solution
|
|
|
|
|
Thanks,
Can I add it like Eval on Bind method as we do for label..
<asp:templatefield headertext="CUST_ID">
<headertemplate>CUST_ID
<itemtemplate>
<asp:label id="lblCustID" text="">]]>' runat="server">
I have the DropDownList instead of Label and "CUST_ID" is the Column name present in the DataTable
A key to every Solution
|
|
|
|
|
You can add the dropdownlist to the template column at runtime. then, In rowcreated event of Gridview, you can find the dropdownlist that you have added and bind the data.
|
|
|
|
|
hi,
thanks friend..
can u give a sample of code how to it...
A key to every Solution
|
|
|
|
|
Hi all,
Can I add Change the PageStyle Button like HTML Buttons in Datagrid using ASP.Net 1.0
Thanks
Dana
|
|
|
|
|
You can't add a HTML button there. Use CSS to style current pager links to look like a HTML button.
|
|
|
|
|
Thanks for the reply Navan,
Can I add the sylesheets in the desing view itself ?
Dana
|
|
|
|