|
Hi Friends,
I have one doubt,i m using datagrid in my datagrid i m having dropdownlist control how to retreive values from the database and bind the values to the dropdownlist control which is inside the datagrid.
Thanks & Regards
Senthil Kumar.T.S
|
|
|
|
|
something like this
public void populate_lokup(string lokup, DropDownList dd)
{
SqlConnection sqlConn = connection.connect();
sqlConn.Open();
SqlCommand sqlcommand = new SqlCommand("as_LokUp", sqlConn);
sqlcommand.CommandType = CommandType.StoredProcedure;
SqlParameter pLokupCode = sqlLokup.Parameters.Add("@lokupcode",
SqlDbType.NVarChar, 20);
pLokupCode.Value = lokup;
SqlDataAdapter daLokup = new SqlDataAdapter();
daLokup.SelectCommand = sqlLokup;
DataSet dsLokup = new DataSet();
daLokup.Fill(dsLokup);
DataTable dtLokup = dsLokup.Tables["table"];
sqlConn.Close();
if (dtLokup.Rows.Count > 0)
{
dd.DataSource = dtLokup;
dd.DataTextField = dtLokup.Columns["columnname"].ToString().Trim();
dd.DataValueField = dtLokup.Columns["columnname2"].ToString().Trim();
dd.DataBind();
dd.Items.Insert(0, "Please Select...");
dd.Items[0].Value = "00";
}
}
|
|
|
|
|
Handle datagrid's ItemDatabound event. Use FindControl() to find the dropdownlist. Fetch values from database and bind to the dropdownlist.
|
|
|
|
|
|
Hi
I have the following loop
foreach (DataRow row in dtorder.Tables[0].Rows)
{
lborder.Text = ;
}
I basically want to add each value from the dtorder to the label, however I am unsure how to do this, any help would be great
cheers
|
|
|
|
|
Hi .NETMan,
Here is the solution
lborder.Text=dr["ColumnName"].ToString();or
lborder.Text=dr[index value].ToString();
Thanks & Regards
Senthil Kumar.T.S
|
|
|
|
|
Hi
i tried this but it only shows one value, why would this be? cheers for the reply!
foreach (DataRow row in dataSetactorder.Tables[0].Rows)
{
lbactcode.Text = row["columnname"].ToString();
}
|
|
|
|
|
.netman wrote: foreach (DataRow row in dataSetactorder.Tables[0].Rows)
{
lbactcode.Text = row["columnname"].ToString();
}
foreach (DataRow row in dataSetactorder.Tables[0].Rows)
{
lbactcode.Text += row["columnname"].ToString();
} you missed the little +
|
|
|
|
|
haha legend cheers!! that sorted it
|
|
|
|
|
Now that I have the loop working how would I compare a value to all the values in the label, for example if I want to see if there is a 2 in the label?
cheers
|
|
|
|
|
.netman wrote: how would I compare a value to all the values in the label,
If you follow this approach it would be difficult to check the value existence. Use a generic List<string> instead. It has a Contains() method which tells the items is already in the list. So inside the loop instead of appending to label's text, you have to add items to this list instance. Once you finish the loop, iterate through the list items and append the text to label.
Hope this helps
|
|
|
|
|
Hi,
I am using Datalist. I am binding Check box for every product and also ID value of that product.That is If there are 3-4 products then each one have one check box. Also ID is attached to Text Property of ChechBox. Now I dont want to show ID that is assign to check box but I want that ID.
Because If 2nd Product Selected then I want ID of that product.
How can I get the ID of that Product?
Thanks
|
|
|
|
|
Store it as an attribute of the checkbox and access it from there.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi All;
Is there is a way to Make Alignment for all data in gridview controle
i want all data to be in center alignment
thnx for your effort and your advice
Kareem Elhosseny
|
|
|
|
|
Just write your templates so each cell contains a div that centers the data.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Sorry Christian It's not clear for me please can you explain it more
Kareem Elhosseny
|
|
|
|
|
for each cell have some html code i.e. a div which has an alignment value in i.e. center
|
|
|
|
|
Sounds like you're using ASP.NET but don't know any HTML, I recommend buying a book on HTML, because that is ultimately what you're trying to create here.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
If you use the Columns-section of your Gridview you can add ItemStyle- HorizontalAlign and set it to Center.
|
|
|
|
|
thnx alot it works
Kareem Elhosseny
|
|
|
|
|
Hi,
I am using Asp.net 1.1 , I am fetching some data for oracle database and i am displaying this data in Datagrid
I am getting the following exception :
Exception of type System.OutOfMemoryException was thrown.
My query is returning 1,20,000 recoreds (when i copied the resultset to notepad it
14 MB)
After searching in internet i updated my web.config as
httpruntime maxrequestlength="1048576" /
But this is also not working.
Please suggest me.
|
|
|
|
|
salmonraju wrote: My query is returning 1,20,000 recoreds (when i copied the resultset to notepad it
14 MB)
I assume this is 1.2 million, does this not seem to you like a bad idea ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
During my early prototyping, form and control names change often, and this requires updating all hyperlinks and redirects to these forms and controls. I'm thinking of some way to intercept a name change, and then update a Phrasebook pattern store of physical URL'
s keyed on logical form names. All suggestions will be welcome, and I would be more than glad to share my final solution as an article if it requires enough work.
Pits fall into Chuck Norris.
|
|
|
|
|
Put the links in a config file and access them from there, then you have one place to change them
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi
I have a set of values which are displayed from a database table and are as so
1,2,3,4,5,6
They are displayed in that order.
However a user can add a number to these already exisiting numbers i.e. add the number 2.
If a user did that I would like all the numbers to re-order so that it would be
1,2,3,4,5,6,7
not
1,2,2,3,4,5,6
I'm not sure what this would be called or what method to use hence why i havent used google yet but if any1 has done this or something similar or knows a way to do it please let me know so I can then start searching for solutions!!
cheers
|
|
|
|