|
Pardhu2 wrote: nable to bind values to Grid Control.
What do you mean by that? Getting any errors? Are you closing the connection before assigning to GridView ? Reader requires connection to be active. Also it is good to wrap the connection, command and reader in using block. It ensures resources are released properly.
using(SqlConnection con = new SqlConnection(DB.ConnectionString))
using(SqlCommand cmd = new SqlCommand("Select * from FB Employees where Empid=101 ",con)) {
con.Open();
using(SqlDataReader reader = cmd.ExecuteReader()){
GridView1.DataSource = reader;
GridView1.DataBind();
}
} The above code is likely to work.
Best wishes,
Navaneeth
|
|
|
|
|
Hi All,
in aspx u need to following thing also.
<asp:boundfield headertext="User Id" visible="true" datafield="login_id">
this will bind corrosponding column to the grid
Thanks and regards,
Amit Patel
|
|
|
|
|
Give this a try.
SqlConnection con = new SqlConnection(DB.ConnectionString);
con.Open();
SqlCommand cmd = new SqlCommand("Select * from FB Employees where Empid=101 ",con);
DataTable table = new DataTable();
table.load(cmd.ExecuteReader(),loadoption.upsert);
GridView1.DataSource = table;
GridView1.DataBind();
April
Comm100 - Leading Live Chat Software Provider
|
|
|
|
|
Hi,
you should create a data table with the column you want to show in your webpage.
DataTable dt = new DataTable("test");
dt.Columns.Add(new DataColumn("id", typeof(int)));//creat Columns
dt.Columns.Add(new DataColumn("name", typeof(string)));
dt.Columns.Add(new DataColumn("timer", typeof(DateTime)));
DataRow dr = dt.NewRow();//creat row
dr["id"] = reader[0].id;
dr["name"] = reader[0].name;
dr["timer"] = reader[0].timer;
...
dt.Rows.Add(dr);
Gridview1.datasource = test;
Gridview1.databind();
April
Comm100 - Leading Live Chat Software Provider
modified 27-May-14 21:49pm.
|
|
|
|
|
Hi all
Iam stuck on the below task
I have Gridview inside gridview in outer gridview i binded the categores which are almost to six and on ROw Data bount event of Outer Gridview iam binding the inner gridview with items Names related to category by passing the category Id.
like
Category People
-- People one
-- People two
-- People three
Category Student
-- Student one
-- Studnet two
Now how i validate that if i checked the category People checkbox chekced then its related items will be unchecked how i make independat to each category and its items
Hope i will hear good comments
Share me the ideas how i approach this
Best Regards
Rameez
|
|
|
|
|
Why you have asked the same question again and Again ?
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Iam really sorry for doubling of the post i dont know how i post the double enteries sorry for that
iam getting applogize for it.
Thanks for the response
Regards
|
|
|
|
|
Hi all
Iam stuck on the below task
I have Gridview inside gridview in outer gridview i binded the categores which are almost to six and on ROw Data bount event of Outer Gridview iam binding the inner gridview with items Names related to category by passing the category Id.
like
Category People
-- People one
-- People two
-- People three
Category Student
-- Student one
-- Studnet two
Now how i validate that if i checked the category People checkbox chekced then its related items will be unchecked how i make independat to each category and its items
Hope i will hear good comments
Share me the ideas how i approach this
Best Regards
Rameez
|
|
|
|
|
Why dont you do this using Javascript ?
find checkboxes through javascript using :
var checkboxes = document.getElementByName('people');
for(var i=0; i<checkboxes.length; i++)
checkboxes.checked = true;
Note: Modify this based on your exact requirement.
|
|
|
|
|
how can i add a textbox or html input to imge with mouse click. i mean every where i click on image a textbox must add to image ...
can you help me please???
M.Alizadeh
|
|
|
|
|
Do you mean clicking on Image will display a text box?
If yes, then where and how would you like to display the text box
|
|
|
|
|
yes i mean clicking on Image will display a text box in position of mouse click . and the text box must be transparent that the picture in image control must be visible under the textbox.
M.Alizadeh
|
|
|
|
|
Use DIV and Put the Textbox inside DIV. Now Show the DIV on click of Image .
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
You can use JS to do that. I got a simple idea:
When left keydown, create a div (or show a div-hidden with textbox) at that point with another layer.
April
Comm100 - Leading Live Chat Software Provider
modified 27-May-14 21:49pm.
|
|
|
|
|
thanks but i am a beginner in asp.net can you show me how could i do this???
M.Alizadeh
|
|
|
|
|
Hi everybody,,
I have a multiline textbox, I set its maxlength to 50, but it does not work well, it still allows to enter more than 50 chars.
how to solve this ?
Regards
Nour Abdel-Salam...
A Trainer and a Web Developer in Jedda Int'l Computer Center(JICC)
|
|
|
|
|
<textarea name="mytext" onkeypress="return (this.value.length <= 50);" ><textarea>
This does the trick.
|
|
|
|
|
thanks dear
it works
Nour Abdel-Salam...
A Trainer and a Web Developer in Jedda Int'l Computer Center(JICC)
|
|
|
|
|
Hi All
I’ve used Obout grid with Row Template,It displays the data from the database fine, when I click edit the edit template appears when I make some changes and click save this error appears
***********************************************************************
Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation
***********************************************************************
This property helped me stopping that message from appearing again
<pages enableEventValidation="false" >
But then the changes are not reflected to DB ,when I debugged the following code I found out that the Event [e] which was supposed to hold the new(changed) data is holding the old data why? How to fix that? :-----------------------------------------------------------------------
Sub UpdateRecord(ByVal sender As Object, ByVal e As Obout.Grid.GridRecordEventArgs)
Dim myConn As SqlConnection = New SqlConnection("Data Source=GP10;Initial Catalog=Integration;Integrated Security=True")
myConn.Open()
Dim m = e.Record("EmployeeID")
Dim mm = e.Record("EmployeeNameA")
Dim myComm As SqlCommand = New SqlCommand("UPDATE Employees SET APUsername=@APUsername, AccountNumber = @AccountNumber, EmployeeNameA=@EmployeeNameA, HasPC=@HasPC, Manager = @Manager WHERE EmployeeID = @EmployeeID", myConn)
myComm.Parameters.Add("@APUsername", System.Data.SqlDbType.VarChar).Value = e.Record("APUsername")
myComm.Parameters.Add("@AccountNumber", System.Data.SqlDbType.VarChar).Value = e.Record("AccountNumber")
myComm.Parameters.Add("@EmployeeNameA", System.Data.SqlDbType.NVarChar).Value = e.Record("EmployeeNameA")
myComm.Parameters.Add("@HasPC", System.Data.SqlDbType.Bit).Value = e.Record("HasPC")
myComm.Parameters.Add("@Manager", System.Data.SqlDbType.VarChar).Value = e.Record("Manager")
myComm.Parameters.Add("@EmployeeID", System.Data.SqlDbType.NVarChar).Value = e.Record("EmployeeID")
myComm.ExecuteNonQuery()
myComm.Dispose()
myConn.Close()
End Sub
-----------------------------------------------------------------------
|
|
|
|
|
I guess you are talking about some ThirdParty Gird Control. It will be better if you ask there forum, so that they can give you proper solution.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
I want to put validation control for CNIC (Computed National Identity Card),
if
CNIC# is: 16304-1064020-6
I want the dashes to be handled automatically. like if I first enter 16304 now if I enter another digit like in this case 1 then the dash between them is automatically putted.
|
|
|
|
|
Then do it. Just handle the keypress of the textboxes you want, and use javascript to put dashes between numbers.
You might also consider Regular Expression to validate the CNIC number after user input. (Might also make use of RegularExpressionValidator).
\d{5}[-|]\d{7}[-|]\d
I think this will work as regular expression. Try it. Well I agree, it can be made shorter.
Cheers.
|
|
|
|
|
Respected,
Can me upload a file without file uploade control.
Thanks.
|
|
|
|
|
Try this..!
http://stackoverflow.com/questions/569565/uploading-files-in-asp-net-without-using-the-fileupload-server-control
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
FileUpload and input type="file" is the same thing. You might use either of them.
You can even trigger the Browse button click when some other control is clicked, but with normal html, it is not possible to upload the file without browser FileUpload .
May be you can use flash object to invoke openfiledialog without FileUpload control. Many sites uses Flash OpenFileDialog to have multiselection of files enabled. It wont be possible for normal html file upload control.
|
|
|
|